Here is a way to use Iexpress 2.0 to wrap your VBS scripts into an .exe. Iexpress 2.0 is native to Win XP and Win 7 and is quite useful when you have a VBS that is dependent on other files, like and install program or even an HTA. Once you have created the .EXE package a .SED file is also create in the same directory, which is the instructions for the Iexpress.exe. You can edit the .SED file in notepad and then run the iexpress wizard and select Open Existing Self Extraction Directive file and create your new package. This is helpful when you want to add new files, change the command line, or the output directory, you do not need to go through the whole package process again. Below are the instructions on how to create a new .EXE using Iexpress 2.0.
1. On a computer running Windows XP or Windows 7, click Start, click Run, enter iexpress, and click OK. This starts the IExpress Wizard.
2. On the Welcome to IExpress 2.0 page, select Create new Self Extraction Directive file and click Next.
3. On the Package purpose page, select Extract files and run an installation command and click Next.
4. On the Package title page, type a title for your package and click Next.
5. On the Confirmation prompt page, select No prompt and click Next.
6. On the License agreement page, select Do not display a license and click Next.
7. On the Packaged files page, click Add and select the vbs script from the directory in which it resides:
8. When you finish adding files, click Next.
9. On the Install Program to Launch page, in the Install Program box, type c:\windows\system32\cscript.exe “yourVBS.VBS” OR c:\windows\system32\wscript.exe “yourVBS.VBS” Leave the Post Install Command box BLANK.
10. On the Show window page, select Hidden and click Next.
11. On the Finished message page, select No message and click Next.
12. On the Package Name and Options page, enter the path and filename that you want for this distribution package. Check both boxes and click Yes to the warning under Options and click Next.
13. On the Configure restart page, select No restart and click Next.
14. On the Save Self Extraction Directive page, select Save Self Extraction Directive (SED) file:, edit the path and name of the file, and click Next.
15. On the Create package page, click Next. When the package has been created, click Finish to exit.
16. The package will now be created with the name you specified and have an extension of .EXE ex. “yourVBS.EXE”
Thanks, LikeToCode...Please click "Mark as Answer" when you get the correct reply to your question.
Tuesday, April 13, 2010 3:36 PMModerator
- Edited by LikeToCodeModerator Tuesday, April 13, 2010 3:38 PM Formatting
Self Extraction Directive (SED) file Explained
Here is a copy of a Self Extraction Directive (SED) file. Keep in mind you can IExpress 2.0 to create an .EXE for many items like batch files, Inf files, VBS files and other .exe files. For this purpose we are talking about VBScripts. You can edit this file and "recompile" your .exe. Why would you want recompile your .exe? To name a few you might find unwanted behavior in your VBS or you may need to add additional files and you don't want to have to go through the entire IExpress setup again, so you would change data in this file and in two clicks your app is recompiled.
First, let’s talk about some important sections in this SED file. There are five sections Version, Options, Strings, SourceFiles, and SourceFiles0. When editing your SED files you will be mostly working in the Strings, SourceFiles, and SourceFiles0 sections, most of the Options section was done when you created the package for the first time.
Here is the strings section with comments:
InstallPrompt= ‘Use if you want the user to confirm your install, I never use this option.
DisplayLicense= ‘Use if you have an EULA or the like, I never use this option.
FinishMessage= ‘If you want to inform the user that your install is done.
TargetName= ‘The directory path and name of your .EXE
FriendlyName= ‘This is the package title and what is help in memory.
AppLaunched= ‘This is the command line REMEMBER to use quotes around directory paths with spaces
PostInstallCmd= ‘If you have an app that need to run last put the command line here.
AdminQuietInstCmd= ‘You use this to tell IExpress when given the /q:a switch what command to use for the internal exe, vbs, hta, etc.
UserQuietInstCmd= ‘You use this to tell IExpress when given the /q switch what command to use for the internal exe, vbs, hta, etc.
FILE0= ‘The name of the source file. Every file you include will have a FILE1= or FILE2= and so on.
Here are the SourceFiles and SourceFiles0 sections:
SourceFiles0= ‘The directory path containing all of the source files listed in this SED file.
[SourceFiles0] ‘For every FILEx= listed in the strings section you MUST have the variable listed here.
Complete Self Extraction Directive(SED) for an app called HelloWorld.EXE
FileDescription=Installer for Hello World
CompanyName=Your Company Name
Wednesday, April 14, 2010 2:19 AMModerator
- Edited by LikeToCodeModerator Friday, January 07, 2011 9:19 PM Added VersionInfo Section
I thought I would expand on one section of the .SED file that I did not cover originally. I found myself having to document a particular install I was working on and I thought this info would be useful to others. In IExpress you can pass command line switches to your internal vbs, hta, exe, etc. at runtime. This is achieved by setting values for AdminQuietInstCmd or UserQuietInstCmd.
Say for instance you have a vbs file that is controlling a software install and you have coded the vbs to accept command line arguments. Those arguments specify what info is passed into the script. You can set the value of AdminQuietInstCmd or UserQuietInstCmd or both with the different COMPLETE command lines including the argument you want to pass and invoke that at runtime using the /q:a or /q switch.
Let's take the above HelloWorld example and demonstrate how this works. First you need to create the Hello.vbs, here is that code.
'Hello.vbs Dim args Set args = WScript.Arguments If args.Count > 0 Then For i = 0 To args.Count - 1 Select Case LCase(args.Item(i)) Case "/admin" WScript.Echo "Hello World!!" & vbCrLf & "You passed the /admin arg." Case "/user" WScript.Echo "Hello World!!" & vbCrLf & "You passed the /user arg." Case Else WScript.Echo "You can only use the ""/admin"" or ""/user"" command line arg or do not specify an arg." End Select Next Else Wscript.Echo "Hello World!!" & vbCrLf & "No command line args passed." End If
Next copy the above SED example into notepad and replace the [Strings], [SourceFiles] and [SourceFiles0] sections with the [Strings], [SourceFiles] and [SourceFiles0] sections below. Be sure to change TargetName and SourceFiles0 to the directory you have saved the Hello.vbs. Now save that file ENSURE the extension is .SED not .txt.
AdminQuietInstCmd=C:\Windows\system32\wscript.exe Hello.vbs /admin
UserQuietInstCmd=C:\Windows\system32\wscript.exe Hello.vbs /user
Now compile the EXE by starting IExpress as described in step 1 of the original post. On the Welcome to IExpress 2.0 page select Open existing Self Extraction Directive file: and browse to where you have the above SED saved. Next click Next> select Create Package and Next> again. On the Create Package screen click Next> and then Finish. Now browse to where HelloWorld.EXE has been saved (in the above example it is saved at C:\Scripts\Iexpress_Installs).
Now you can run the HelloWorld.EXE 3 ways, with the /q:a argument or the /q argument or no arguments.
1) The /q:a argument will pass the /admin argument into the script and you will get a messagebox that says "Hello World!! You passed the /admin arg."
2) The /q argument will pass the /user argument into the script and you will get a messagebox that says "Hello World!! You passed the /user arg."
3) If you run it with no arguments you will get a messagebox that says "Hello World!! No command line args passed."
Simply remember that to access the AdminQuietInstCmd command line you use the /q:a switch and to access the UserQuietInstCmd you use the /q switch.
The /q:a is Admin Quiet mode and does no checking for admin rights, disk space and etc. No prompts and no errors. Great for unattended installs. The /q:u is User Quiet mode which can be used for the end user and it presents some dialog boxes and still gets warnings on admin checks or disk space issues. The /q is quiet mode and suppresses prompts like when files are being extracted, etc.
v/r LikeToCode....Mark the best replies as answers.
Thursday, January 06, 2011 10:31 PMModerator
- Edited by LikeToCodeModerator Friday, January 07, 2011 1:18 AM Spelling
Thank you very much . This is very useful. Can you please advise how I can pass the argument from the command prompt.
I am running a .vbs file . I have many configuration files .cfg files to run with the same .vbs files. Until now I used to use the exescript on 32 bit. But have 64 bit now. So I want to run the exe with the argument passed to the .vbs file. I dont want to make an exe for each .cfg file .
Is there any method to pass the argument from the command prompt where I run the exe? I can include all the .cfg files in the SED. But dont know how to trigger the exe for each config file. PLEASEEE HELPPPPThursday, May 24, 2012 2:32 AM
Just use Exe From Vbs v1.1 (Portable freeware)
Thursday, June 21, 2012 2:20 PM
- Edited by wtarkan Friday, November 08, 2013 7:30 PM
Ther is no reason to get abusive.
Sometimes this site loses a post. It was likely not deleted. You would do well to edit the langauge of your last post. After all this is a family site - right?
Alsio note you are using this site to advertise. Givenyou langauge I would guess that not many will be interested in visiting your site.
You need to stop spamming.
Thursday, June 28, 2012 9:26 PM
- Edited by jrv Thursday, June 28, 2012 9:29 PM
This is great (well, the only, heh) reference on iExpress that I've found. Thank you for posting this.
I'm curious if there's a way to use wildcards (*.*) for the file selection. I'd rather just package an entire directory instead of having to explicitly define each file individually.
Is this possible?
MichaelWednesday, August 15, 2012 3:51 AM
Installers tend to be very much file-by-file, since they need to support uninstall that does not delete any files the user may have added since the install; sometimes configuration or other data.
If wildcards are not supported, perhaps use the cmd.exe's FOR command to append each file in the wildcard to the iExpress input file (the SED file).
So, the command script (batch file) would ECHO all the static lines to the SED file using ECHO. with the > operator (redirect with (re)create) to create the SED file, and each of the following lines using the >> (redirect with append). Then using the the FOR command to redirect with append each file in the wildcard.
One trick to this would be creating the incrementing file index used in the SED formation. However, I'm sure a CmdScript expert could figure out a tricky way to do it. Or perhaps just do all of this from a VBS or JS script.
Wednesday, August 15, 2012 4:03 AM
- Edited by Mystic Taz Wednesday, August 15, 2012 4:11 AM More Info
Thanks, Mystic Taz. I ended up exploring PowerShell and writing my first script to dynamically create an SED from a provided directory. Pretty cool stuff:
Here's the template I used to create the SED:
(Guess you can say I'm a fan of PowerShell now. :))Sunday, August 26, 2012 9:30 PM
This DID NOT WORK for me!!!
No matter what I try, I keep getting the message:
Command line option syntax error. Type Command /? for Help.
Is it possible to pass command line parameters to my script so that I can run an .exe from my .vbs script with parameters?Friday, December 14, 2012 3:12 PM
This DID NOT WORK for me!!!
No matter what I try, I keep getting the message:
Command line option syntax error. Type Command /? for Help.
Is it possible to pass command line parameters to my script so that I can run an .exe from my .vbs script with parameters?
Tis topic has been closed and answered for years. Please start a new topic with your question.
¯\_(ツ)_/¯Friday, December 14, 2012 3:17 PM
I am working on packaging up an Eclipse/Notes plug-in installer and need to bundle a compiled MSI installer into a single EXE. Unfortunately I don't have control over how the original install set is built - it is 'compiled' by a utility that mashes a bunch of .jar files onto the side of a template MSI installation and the 'installs' those .jar files into Notes via Custom Actions that live in the template .msi file. The template MSI file then interprets an include .xml file for provisioning Notes with the new plug-ins. Kind of cool, in an "Oh my God I can't believe they thought that was a good idea but it kind of works" way.
I suppose none of that really matters for this discussion. What matters is that I have a tree of files that I need to package and then have unpacked as a file tree, not a flat list of files.
My question is this: is there a way to accomplish the preservation of the file hierarchy either through the iExpress wizard or by hand editing the .SED file?
Dave Brooks Principal, Installer Factory, LLC firstname.lastname@example.orgThursday, December 20, 2012 8:55 PM
1. This is a very old discussion; in addition, I believe the aforementioned iexpress tool is deprecated.
2. Remember that this is a scripting forum. If you have a scripting question, please start a new question and be as specific as possible as to what your specific scripting question is.
BillThursday, December 20, 2012 8:58 PMModerator
Hi Bill -
I hadn't noticed the original posting date, just the Friday, December 14, 2012 3:17 PM date on the message I replied to.
Since you are a moderator and I don't spend much (any) time in the scripting forums, perhaps you can point me at the correct forum to post to? The gist of my question is: What is the current best-practice tool and technique for wrapping up a bundle of files (in a tree) into a self extracting/self executing archive? I would prefer to make the process automated since this will be the last step in an automated build.
Dave Brooks Principal, Installer Factory, LLC email@example.comThursday, December 20, 2012 10:31 PM
perhaps you can point me at the correct forum to post to?
Sorry, I don't know, but you could peruse the list of TechNet Forums and perhaps something will look applicable.
The gist of my question is: What is the current best-practice tool and technique for wrapping up a bundle of files (in a tree) into a self extracting/self executing archive? I would prefer to make the process automated since this will be the last step in an automated build.
I personally use the 7-Zip tool for lots of things. But again, your question is really not within the scope of this forum.
BillThursday, December 20, 2012 10:59 PMModerator