Exploiting the Runbox - Part 2 ° home | < back | next > 
Taking Batch files further                 
Here is a more complicated script, expanding on the one I covered in Part 1.

START c:\"program files"\"mozilla firefox"\firefox.exe "http://www.virtualplastic.net/"
START d:\"paint shop pro 7"\psp.exe "D:\2k screenies\041215 piki & poko.png"
START d:\winamp\winamp.exe "E:\mp3s\Nightwish - Once\00.m3u"

The script above not only runs programs, each program opens a file on loading too. Lets look at this line by line. First we have the START command, then the path to the program we want to run, followed by the file we want the program to open. Remember, folders with spaces in their paths need to be placed in commas. Now, unlike the program paths, The FULL path to each file is to be put in commas. You may have problems with opening files if you omit the commas.

(Conversely, I found that Inedita couldn't open files surrounded with commas, and can open a file WITH spaces in the path. Since this is rare, use commas to begin with, if it doesn't run, take them out.)


Minimized/Maximized..
When launching many programs things can quickly seem messy. A way round this is to utilize the /MIN and /MAX commands to control how the windows are displayed when launched. In the following example, Colorpad will run minimized and Paint Shop maximized:

START /MIN d:\colorpad\colorpad.exe
START /MAX d:\"paint shop pro 7"\psp.exe


Programs with Tabbed Windows
Two programs I use (Firefox and EditPad) have tabbed window functionality. The next script examples will focus on opening a group of files for each program. Its common for me to be working with over ten files at once in EditPad. Here is a batch file I created whilst developing this site:

START d:\editpadlite\editpad.exe "F:\pixelarmy.org\serenity\index.htm"
START d:\editpadlite\editpad.exe "F:\pixelarmy.org\serenity\run.htm"
START d:\editpadlite\editpad.exe "F:\pixelarmy.org\serenity\run2.htm"
START d:\editpadlite\editpad.exe "F:\pixelarmy.org\serenity\hexediting.htm"
START d:\editpadlite\editpad.exe "F:\pixelarmy.org\serenity\unpacking.htm"
START d:\editpadlite\editpad.exe "F:\pixelarmy.org\serenity\dev.bat"

I named it dev.bat and set that to open too, so I could easily add paths to new pages as I write them.


Multiple tabs in Firefox
Firefox works a little differently to EditPad when opening multiple files. If I were to use the script for EditPad as a guide, I'd end up with six instances of Firefox! Here is a simple script to open Gmail and Google in Firefox. You can add as many urls as you like, seperate each one with a | and enclose all urls together in a single pair of commas like this:

START d:\firefox.lnk "http://gmail.google.com/gmail|http://www.google.com/"

Note that I'm using a link to firefox and not specifying the direct path to the program. This is so I don't break the tables! You can also omit the http:// from the urls, though bear in mind this creates more work for the browser.


Browsing Folders
Two graphics programs I use have the option to Browse Folders. Both of them can add a "Browse with.." to the context menu, however, they each use different command line switches to do so. Here is a script that will open the same directory in both IrfanView and Paint Shop.

START d:\"paint shop pro 7"\psp.exe -browse "F:\pixelarmy.org\serenity\hexediting"
START d:\irfanview\i_view32.exe "F:\pixelarmy.org\serenity\hexediting" /thumbs

The command switch to browse the directory in Paint Shop is -browse. You need to add this BEFORE the path to the folder, whereas with IrfanView, the command to browse is /thumbs, which needs to come AFTER the path to the folder.


Creating Shortcuts via the Registry
App Paths creates and manages keys at this location in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

To add a new shortcut via the registry, simply create a new key under App Paths, the name of which will be the shortcut you want to type in the runbox. The keys default value is where you enter the path to what you wish the shortcut to link to.


Getting paths quickly with Path To Clipboard
I find this context menu extension indispensible. With it I can click on any file or folder and copy its path to the clipboard, ready to paste where I need to, be it in batch scripts or app paths in the registry. Download it from here.


~Serenity

^ top | ° home | < back | next >