Create .exe from .bat or .vbs with IExpress

Tested on Windows 10, 64bit

If your program allows you to run an .exe file but not a .bat or .vbs, you can easily transform your file into .exe with IExpress which is already available on Windows.

Create the EXE

First, create your file, let’s say BkpFilesNow.bat or BkpFilesNow.vbs

From the windows button search for IExpress. It is preferably to run it as administrator, so instead of just click on it when you find it, right-click and choose Run as Administrator. You’ll be prompted to allow the program to make changes to your computer, click Yes.

Here are the steps of the wizard:

  1. Leave unchanged: Create new Self Extraction Directive file
  2. Leave unchanged: Extract files and run an installation command
  3. Give a name to your new package 
  4. Leave unchanged: No prompt
  5. Leave unchanged: Do not display a license
  6. Find your .bat or .vbs file and add it to the list. If your main file calls other files, you should add all of them to this list.
  7. Specify which file will be executed when you run the .exe file. The command will be different depending on the file type. For .bat files write like:
     
     
    1. cmd.exe /c BkpFilesNow.bat

    For vbs use one of the following ones:

     
     
    1. c:\windows\system32\cscript.exe BkpFilesNow.vbs

    OR

     
     
    1. c:\windows\system32\wscript.exe BkpFilesNow.vbs

    Important: if the file name contains spaces you should use double-quotes, like “Bkp Files Now.bat” or “Bkp Files Now.vbs”

  8. Choose Hidden 
  9. Leave unchanged: No message
  10. Select the path and a name you want to save the file with. Check the 2 check-boxes. The second one will show you an warning – click Yes
  11. Choose No restart 
  12. Leave unchanged: Save Self Extraction Directive (SED) file. This file will help you in the future if you need to modify the .exe – it will load all settings you done so far.
  13. This is the final screen, when you’ll click Next, your .exe file will be created.
  14. The confirmation screen will show you the status. Click on Finish to end the wizard and save the SED file.

 

Using the SED file

If you do some changes to your .bat or .vbs file you will need to rebuild the .exe file. Having the SED file will speed up the process.

Open IExpress as administrator as above and:

  1. Choose this time: Open Save Self Extraction Directive file. Browse to select the saved SED file.
  2. At this step, if you choose Create package, the wizard will skip to step 13 since it has all the information needed. If you want to modify the settings, let’s say the file name changed or you need to add more files, select Modify Self Extraction Directive file. This way, the wizard will show all steps with the settings stored in the SED file, allowing you to make changes at each step.

You can also modify the SED file using Notepad and use it then in IExpress. Here is an example of SED file:

 
 
  1. [Version]
  2. Class=IEXPRESS
  3. SEDVersion=3
  4. [Options]
  5. PackagePurpose=InstallApp
  6. ShowInstallProgramWindow=1
  7. HideExtractAnimation=1
  8. UseLongFileName=1
  9. InsideCompressed=0
  10. CAB_FixedSize=0
  11. CAB_ResvCodeSigning=0
  12. RebootMode=N
  13. InstallPrompt=%InstallPrompt%
  14. DisplayLicense=%DisplayLicense%
  15. FinishMessage=%FinishMessage%
  16. TargetName=%TargetName%
  17. FriendlyName=%FriendlyName%
  18. AppLaunched=%AppLaunched%
  19. PostInstallCmd=%PostInstallCmd%
  20. AdminQuietInstCmd=%AdminQuietInstCmd%
  21. UserQuietInstCmd=%UserQuietInstCmd%
  22. SourceFiles=SourceFiles
  23. [Strings]
  24. InstallPrompt=
  25. DisplayLicense=
  26. FinishMessage=
  27. TargetName=C:\TEMP\BKPLOGS.EXE
  28. FriendlyName=Backup Logs
  29. AppLaunched=cmd.exe /c BkpFilesNow.bat
  30. PostInstallCmd=<None>
  31. AdminQuietInstCmd=
  32. UserQuietInstCmd=
  33. FILE0="BkpFilesNow.bat"
  34. [SourceFiles]
  35. SourceFiles0=C:\TEMP\
  36. [SourceFiles0]
  37. %FILE0%=