
Step 1
Navigate to C:\Windows\System32 and locate the file named IEXPRESS.EXE
Step 2
Double Click to launch IEXPRESS.EXE
Step 3
You will be presented with the initial welcome screen and be given two choices. Select “Create new Self Extraction Directive file.” Click Next.
Step 4
Next you will be presented with the Package Purpose screen. For our purposes select “Extract Files and run an installation command” and click the Next button.
Step 5
You will be presented with the Package Title screen, which will give you the opportunity to give your project a name. If you are so inclined give it a meaningful name. If like me you are never going to come back to this, name it whatever you want.
Step 6
You will next be presented with the Confirmation Prompt Screen. We would like the batch file to just be extracted and run so just choose “No Prompt” and click the Next Button.
Step 7
You are presented with the License Agreement window. If you don’t want your users to have to answer a prompt select “Do not display a license.”
Step 8
The Packaged Files window is where you will select your batch file (or .vbs). Click the Add button and browse to your desired file. Then click next.
Step 9
Here you are presented with a window titled Install Program to Launch. Use the drop down control next to “Install Program and choose the only option that will be present, the .bat or .vbs file that you chose in the previous window.
Step 10
The Show Window screen is next. I didn’t want my users to be prompted in any way so I chose Hidden. Click Next.
Step 11
No Finished Message for my users. Select “No message” and choose Next.
Step 12
The Package Name and Options window is where the new .exe specified. Type in a path or browse to the folder you would like your .exe in, type a name in the file name box and click save. Also check the box that says “Hide File Extraction Progress Animation from User.” If you’re worried about long file names go ahead and click the other box as well.
Step 13
Since we really aren’t installing anything we probably want to tell the Configure Restart window to not restart. So choose the option that says “No restart” and hit Next.
Step 14
This window is where you have a chance to save all of the options you have chosen into a project file so that if necessary you may later return and make modifications. I have no need to retain the file, but if you would like to be able to come back to it, by all means choose “Save Self Extraction Directive (SED) file” and tell it where to put it. As always, click Next.
Step 15
Here’s where you’re new .exe is born, on the Create Package screen. Explore to the directory you told it to put the file in, click Next and then watch your little .exe’s first moments as it pops into the big digital world.
Step 16
You’re done! Click finish and go try it out. Pin it directly to the start menu. Point a shortcut to it and pin that to the start menu. Most importantly, script it and see how slick it is. If you’re not familiar with how to script start menu pinning the scripting guys will tell you how. Check it out here!

35 comments:
Wow! This is great. I can't believe I have never heard about this. I just tested it with a .vbs and a .bat file. Works flawlessly. Thank you for posting this. I'll be converting a bunch of bat files on the network to exe.
Steve --
Cool tip! I hope you blog more frequently in the future!
Kind of helpful, thanks.
I needed to know about this a couple of years ago - better late than never ;) Thanks.
Awesome find!!
Tried it with a .bat script which contains the command cd %CD% - the resulting .exe uses a temp file for the env. var %CD%.. any ideas?
thanks. it's very helpful.
You are aware, of course, that you are NOT making an .exe of you .vbs/.bat file? IExpress is a single file self-extractor, when it runs, it STILL runs the .vbs/.bat. Microsoft themselves use this to make single-file installers (or they used to).
Yeah, I'm aware that it isn't compiling a true exe. Since all I want is for it to appear as an exe to the Start Menu, for me it doesn't matter. I'm just interested in the quick, easy and FREE way to do this.
there used to be a program around that did this very thing during the times that dialup bbsing was dying and the internet was growing. at the time i was pretty good at batch file programming and so caused much mischief on some dialup bbses.
this is great...i was using bat2exe all these years!
iexpress has been around for a long time, I used to use it to build packages for windows 95 - an earlier version of it though, I think it may have been included on the original IE4 preview CD also.
I have the same problem as the user with a "cd %CD%" in his batch file.
In my case, I have 2 lines that read:
set websmdir=%WSMDIR%
if "%websmdir%" == "" goto ERRORMESSAGE
When running my "exe", I received 3 error lines in my command window:
Bad command or file name
Out of environment space
Environment variable WSMDIR must be set to the install directory of websm.
The last line is due to the above "if" directive in my bat file.
I take this to mean that the exe's environment does not have enough space for all my environmental variables.
Any suggestions?
Dennis
The vbs file doesn't show up in the list. Any ideas why not.
This is exact what I am looking for. Thanks your tips.
One question:
Is the way secure if a batch file contains password?
The tip was really helpful; Thanks a ton
This is great, I never thought you could do that. That's a cool idea. Thanks a lot for the post.
Hoping to see more ideas from your blog. Also added it to one of my favorite tech blogs.
Jann-
This is excellent and all, but is there a way to make this work in 64-bit Windows without a command.com?
This is fantastic, I can't thank you enough.
this is great, but the only thing why im trying to convert a BAT to EXE is for the user, to NOT SEE its contents. and that can easily be done by doing right clic on the generated EXE and clic "WINZIP / EXTRACT TO .... "
but that can be override with aspack.
Thanks!
Great!!!!!!!!
Really Appreciated ~
Thanks
Akhilesh Gupta
Wow, great tutorial. Thanks!!!
Handy idea for a tool, but you can also create a shortcut to cmd.exe or wscript.exe and pass the .bat or .vbs file respectively as a parameter, windows will then recognize the shortcut as going to an exe, and you get the same end result.
Wow, how come i never heard about it ! thanks :)
btw, you may check this ONLINE FREE converter to convert your vbs files to exe ! VBS2EXE
The idea is great !!!. But I had the same problem which some of the other people had when accessing the environment variables
like %MYVAR%.
I found the solution.
Simply create a new file called
init.bat
and write the following lines into it.
===============
@echo off
C:\Windows\System32\cmd.exe /C run.bat
===============
where "run.bat" is the file where you write the actual installation logic. The cmd.exe with the "/C" executes your "run.bat" with the environment of the system. So that solves the problem.
Cheers !!!
Ashish.
Hi, regarding the problem with accessing the environment variables, and also in 64bit Windows, where there is no "command.com", I found a solution.
In the step 9 of the explanation, wherein you specify the batch file to be executed in the drop-down control, the normal way is to specify the name of batch file for eg: run.bat
but you can specify the following command instead
cmd.exe /C run.bat
In this case, the batch file runs with the system environment, and also you directly specify that it should be run using cmd.exe, so there is no question of command.com on 64 bit windows. Also there is no need of the init.bat, which I mentioned in my earlier post.
Note: always take care that you use shortnames 8.3 format for the batch file like "run.bat"
Cheers !!!
Ashish.
This is a great idea for packaging files but does not actually convert anything. Better title for post would be "How to Package a .Bat or .VBS file"... It is slightly misleading for less experienced users.
Batch File Compiler and Quick Batch File Compiler are two very good compilers for batch files. Only problem I experience is passing environment variables between two compiled exe files. Otherwise they work really well and Quick Batch File Compiler allows packaging of additional files.
This realy works!!!!!!!!
I was all set to be psyched about this. And then...
I'm getting the error window, "Unable to open the Report file '(filepath).RPT'." When I click OK, IExpress says "Error creating Cabinet."
I can't proceed further. Any idea what's happening?
By the way, Anonymous' comment just above sounds useful too. Would you mind clarifying how you would "pass" the BAT file?
Thanks for this tip!
Lifesaver!
in the installation prompt you have to type 'wscript filename.vbs'
cyßrhWk
Thanks for the nice tip
:-)
useful one
@Greenlight: Running as administrator should fix the "unable to find xxx.rpt" problem.
cool stuff..i was using some quick batch file compiler and stuff...and needed to purchase the software...and i came thru this...
you rock...thank mate...
Hi....
Thanks for this tip....
I don't write good, but thanks...
Post a Comment