Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Invoking the Windows command line for selected directories

by ikegami (Patriarch)
on Nov 27, 2006 at 18:43 UTC ( [id://586310]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://586310]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (10)
As of 2024-04-16 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found