Wednesday, July 05, 2006

How to Convert a .BAT file or .VBS file into .EXE to Enable Pinning to XP Start Menu

Windows XP will not allow you to pin a shortcut to the start menu that points to a network drive. For this reason it can be necessary to write a batch file to launch a program. The issue is that a shortcut pointed to a .bat file also contains no “Pin to Start Menu” option. While it can be dragged onto the start menu, this leaves no option for scripting these shortcuts. The simple solution is to convert the .bat file to an .exe file and lucky for us Windows XP includes a tool that can do it…



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!

No comments: