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.
Jump to
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:
- Leave unchanged: Create new Self Extraction Directive file
- Leave unchanged: Extract files and run an installation command
- Give a name to your new package
- Leave unchanged: No prompt
- Leave unchanged: Do not display a license
- 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.
- 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:
- cmd.exe /c BkpFilesNow.bat
For vbs use one of the following ones:
- c:\windows\system32\cscript.exe BkpFilesNow.vbs
OR
- 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”
- Choose Hidden
- Leave unchanged: No message
- 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.
- Choose No restart
- 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.
- This is the final screen, when you’ll click Next, your .exe file will be created.
- 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:
- Choose this time: Open Save Self Extraction Directive file. Browse to select the saved SED file.
- 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:
- [Version]
- Class=IEXPRESS
- SEDVersion=3
- [Options]
- PackagePurpose=InstallApp
- ShowInstallProgramWindow=1
- HideExtractAnimation=1
- UseLongFileName=1
- InsideCompressed=0
- CAB_FixedSize=0
- CAB_ResvCodeSigning=0
- RebootMode=N
- InstallPrompt=%InstallPrompt%
- DisplayLicense=%DisplayLicense%
- FinishMessage=%FinishMessage%
- TargetName=%TargetName%
- FriendlyName=%FriendlyName%
- AppLaunched=%AppLaunched%
- PostInstallCmd=%PostInstallCmd%
- AdminQuietInstCmd=%AdminQuietInstCmd%
- UserQuietInstCmd=%UserQuietInstCmd%
- SourceFiles=SourceFiles
- [Strings]
- InstallPrompt=
- DisplayLicense=
- FinishMessage=
- TargetName=C:\TEMP\BKPLOGS.EXE
- FriendlyName=Backup Logs
- AppLaunched=cmd.exe /c BkpFilesNow.bat
- PostInstallCmd=<None>
- AdminQuietInstCmd=
- UserQuietInstCmd=
- FILE0="BkpFilesNow.bat"
- [SourceFiles]
- SourceFiles0=C:\TEMP\
- [SourceFiles0]
- %FILE0%=