May 20, 2009

Posted by in Tech Tips | 2 Comments

Packaging VBScript or Batch files into an exe

As part of a project recently to build a customised IE deployment I was looking for a way to run a custom VBScript after the install. With Microsoft’s IEAK it is possible to include either an exe or a cab file that runs after IE has been installed. Great so now I just need away to package my vbs file up as an exe… well luckily Microsoft includes a tool (called IExpress) with all current versions of windows that lets you create a standalone exe file that runs your script.

In this step-by-step I am using IExpress from Windows 7 but the same steps apply for either Vista or Windows XP.

  • Browse to your system32 folder (normally c:\windows\system32) and run iexpress.exe
    • In Vista and Windows 7 you can just type iexpress into the start menu search

image

  • Create a new installer package and click next
  • Choose “Extract files and run an installation command”
  • Give your package a name
  • Choose not to prompt your users if you want to run the package silently
  • Do not display a license agreement
  • Add the files that you need included with your script
    • It is possible to include any other files required by your script at this stage

image

  • Type the command to run after extracting the files for a VBScript file this would be “cscript <script name>”

image

  • Choose if you want a window to be shown when running the package, for mine I chose “Hidden” as I want it to run silently
  • Choose if you want a message to display at the end of installation, again choose “No message” for a silent install
  • Choose a name for your exe and the destination to save the completed exe
    • I choose to hide the extract animation for a silent install
    • I also recommend using the “long file name” option to ensure your commands and references to other packaged files work correctly. When choosing this option you will see a warning about compatibility with Windows 95, most of the time you can safely ignore this!

image

  • Choose if your package should prompt for a restart after whether users are asked first
  • On the last screen you can choose the save the project out as a SED file for usage again later

image

You should now have a self extracting .exe file that can be used as part of your deployments or scripting escapades. I have successfully used this method to package up a VBScript along with some Microsoft updates that are silently installed by the VBScript one by one.

  1. Handy tip Bibble. Thanks!

  2. Thank you Sooo much!

Leave a Reply

Your email address will not be published. Required fields are marked *