[python-win32] want to leave DOS console at any target dir

Charlie charlie at sallyAndCharlie.com
Mon Nov 19 03:18:12 CET 2007


When launching a python script from a DOS console, 
I can not find a way to leave the DOS console at a working directory 
other than the initial working directory.  

os.chdir only seems to work for the python script context, not the DOS context.

I guess this amounts to a work-around for no "os.fchdir" function in python for
Windows.

My current approach (which is an eye-sore) is to:
1) Launch a BAT file
2) The BAT file launches my python script
3) the python script creates a 2nd BAT file with a "CD c:\xxx\yyy" command
4) The 1st BAT file calls the 2nd BAT file when the python script terminates.

Yikes.

Please tell me there's something better.

Thanks



More information about the python-win32 mailing list