How to set working directory

Jul 29, 2011
I purchased Take Command last week. I have a number of CMD files to create and maintain in a number of different directories. Each has references to other files, mostly SQL scripts, and uses relative paths from the current (location of the CMD file) directory. When I load the CMD file in the debugger, none of the file references work correctly. I have been searching this website for a way to set the working directory during a debugging session and have not been able to find help. A search of your documentation also revealed nothing.

Can you please tell me how to get the current directory set to the location of the CMD file during a debugging session?


Jim Brandley
Last edited:
The batch debugger inherits its working directory from the instance of TCC which starts it, so just CD-ing to the batch file's location should do it.

If the BDEBUGGER's current location is not the same as the location you started it from, then chances are you're changing directories in your TCSTART file.
It did not work. See the screen shots in the attached PDF file. Aslo, I do not see any TCSTART file.




  • TakeCommandDirectoryProblem.pdf
    176.8 KB · Views: 200
Last edited:
In the PDF, it looks like the debugger was already running when you CD'd. That needs to be done before starting the debugger. The debugger inherits TCC's directory when it (the debugger) is started, and only if it's started by TCC. If you're using TC (TakeCommand) to start the debugger, it will get TC's current directory (which is quite likely to be different from TCC's).
The screen captures came after it failed, so the debugger tab shows up too. I did not start that until after I changed directories.

How did you start the debugger? If you gave TCC the command "BDEBUGGER ..." it should have TCC's current directory.
I did this:
1. Launch Take Command from the shortcut on the desktop.
2. CD C:\Projects\depot\tps\task\eagan3\src\sql\sqlserver
3.From main menu, select Tools/Edit/Debug
4. From the pop-up window, select File/Open and select the CMD file I am testing.
5. Click the start button.
6. Click the Run to breakpoint or end button.

vefatica - Substituting BDEBUGGER for step 3 above fixed the problem! It appears that the debugger launch from the menu and command line behave differently.

Thanks for your help.

Last edited:
Rather than changing TCMD's CWD, you can
- reference a fixed directory (e-g D:\MyHome\MyJunct),
- have this directory be a soft link (MKLNK thedirIwant D:\MyHome\MyJunct),
- have the button call a script (e-g D:\MyHome\BDebuggerInMyJunct.btm) that CDs to the soft link (cd %@truename[\MyHome\MyJunct] && BDEBUGGER …).

Similar threads