You can turn scripts into redistributable executable files with existing software in Windows Vista and Windows XP. Windows Vista and Windows XP both have a rarely used tool known as IExpress. The tool allows you to wrap an executable file around your scripts so that you can distribute any script as an .exe rather than distributing a "raw" script file (.bat, .vbs, etc.). This eliminates the need of explaining to non-technical users how to execute scripts through the Command Prompt. This is an extremely useful tool for turning Visual Basic script files and other non-executable scripts into one-click executables. If you would like to learn more information about IExpress, you can read the documentation at Microsoft TechNet.
Before you begin the installation process, you will need two files. The first file is the script you would like to bundle into the executable. The second script must be the batch file that you use to execute your script. For example: if your script is a visual basic script (.vbs) you need a batch file (.bat) that will run your script. The following are two simple examples of scripts to help drive home the point: hello.vbs echo "hello" runhello.bat cscript hello.vbs If you are unfamiliar with visual basic scripts and batch script syntax the "cscript" command shown above is needed to execute the hello.vbs file. Launch IExpress in Windows Vista by clicking the Start button and typing iexpress. In Windows XP, launch IExpress by going to Start >> Run and typing iexpress. Start a new project by selecting Create new Self Extraction Directive file and click Next.
Select Extract files and run an installation command and click Next.
Type a name for your executable and click Next.
You will be asked whether you want to prompt the user to confirm the installation of their package. For the purpose of this tutorial click No prompt and then click Next. If you wanted to prompt a user with a message you could choose "Prompt user with" and enter your message in the box below the prompt.
Similarly, you will be prompted whether or not you would like to display a license agreement. For the purpose of this tutorial choose Do not display a license and click Next.
On the Packaged files screen choose Add and be sure to add your script and your executable script (hello.vbs and runhello.bat) and click Next.
Your executable script should now be visible in the "Install Program" drop down. Select the batch file and leave the "Post Install Command" as "<None>" and click Next.
Leave the original selection as Default (recommended) and click Next
Leave the Finished message selection as No message. Similar to the confirmation prompt dialog (shown above), if you wanted to have a display message after your script runs, you could choose "Display message" and enter the message into the box, click Next.
On the Package Name and Options dialog, click Browse.
Enter a file name and location and click Save and then click Next on the Package Name and Options dialog shown above.
On the Configure restart dialog, choose Only restart if needed and click Next
You can save your IExpress configuration in case you would like to come back and edit it later. For the purpose of this tutorial choose Don't save and click Next.
All of your configuration is complete and you are now ready to create the executable. Click Next to begin this process.
The executable will now be created and click Finish to close the IExpress Wizard.
Here is what you've learned to do:
- Create simple visual basic and batch scripts
- Use IExpress Wizard to create executable wrappers for your scripts