in reply to Invoking the Windows command line for selected directories

(Update: Once you solve your problem, you might want to use wperl instead of perl. ActivePerl's wperl is identical to their perl, except it doesn't open a console window. By using wperl, you won't see the console blink in and out. )

When I misread your problem, I thought you might have found the following batch file useful.

(Update: Corion just informed me that cd /d drive:\path does the same as the following. )

@echo off if (%1)==() ( cd goto Exit ) if (%1)==(/?) goto Usage if not (%2)==() goto Usage for %%p in (%1) do ( %%~dp cd "%%~fp" ) goto Exit :Usage echo usage: %0 [ {rel_path} / {abs_path} ] echo. echo Switches to current drive and the current dir to those echo of the supplied path. echo. echo If no argument is supplied, displays the current dir. :Exit
You can use it as follows:
mycd d:\
mycd "C:\Program Files"
# Start a shell in d:\ cmd /k mycd d:\
# Start a command in d:\ cmd /c mycd d:\ & mycommand args