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:

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
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.
Jul 29, 2011
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: 81
Last edited:
May 20, 2008
Syracuse, NY, USA
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).
Jul 29, 2011
The screen captures came after it failed, so the debugger tab shows up too. I did not start that until after I changed directories.

May 20, 2008
Syracuse, NY, USA
How did you start the debugger? If you gave TCC the command "BDEBUGGER ..." it should have TCC's current directory.
Jul 29, 2011
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.

Jul 29, 2011
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
Thread starter Title Forum Replies Date
R Fixed set /r has stopped working in build 35 Support 4
rps Fixed Win "set /p" not working in V17 build 53 Support 3
Dan Glynhampton Fixed @version "force" flag not working, and unable to set separator Support 3
V Set path permanently from within TCC? Support 3
S Debugger keeps breaking with no break point set. Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
R How to? Set default application in a special folder Support 4
A How to? Set up SMTP password in TCC-RT Support 1
vefatica WAD More SET /A woes Support 4
vefatica SET /A and multidimensional array. Support 1
M How to set Path variable for non-executable file extensions in 4DOS Support 8
D Need to set Take Command font size when switching to high DPI display Support 0
P "Set" command behavior - a bug? Support 3
M How to? Set the ribbon titles to mixed case Support 1
X How to set %_INIREAD result to variable Support 5
M WAD Set statements in () causes problems Support 8
M How to? How to set a default TITLE for newly opened tab? Support 2
M Fixed Set "VAR=VAL" format causes problems Support 12
vefatica SET /A var=expression=digits Support 3
cxxl Set encoding for batch file Support 4
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
vefatica SET /A var\=...? Support 10
dcantor Documentation SET /T: missing from heading Support 0
fpefpe Documentation Set /v Support 4
vefatica What's SET /Z? Support 1
BeechComer Debugger: how to set %1 variable? Support 3
fpefpe How to? Global variable set /v Support 4
fpefpe Documentation Can the title line of tcmd be set? Support 4
Jay Sage Failure of ACTIVATE to Set a Window Position Support 3
vefatica SET /A "var%=N", TCC vs. CMD Support 0
J Set environment variable from stdout of command Support 3
B How to? Pre-set _tcfolder on startup when Folders is set Auto-Hide Support 6
R WAD /= size ranges not set correctly Support 5
S How to? Set the timestamp of ZIP command built archive to match latest member Support 8
Mordachai Help! How to set parameters for script I'm debugging?! Support 6
Roedy SET= Support 2
A How to? Set up a log file for all command output Support 3
M Fixed character set in dir/copy Support 3
Phileosophos Fixed TakeCommand exits upon "set [" command Support 14
R How to set comspec to point to cmd.exe? Support 5
S WAD SET problem - array element initialization Support 11
C Wildcard expansion in FOR set Support 27
vefatica SET question Support 16
T Set 1% then Echo 1% Support 9
S SET /A question; HELP nits Support 8
noahcoad copy /w to FTP does not set time stamp Support 1
M A request for a new feature for the "set" command... Support 5
cgunhouse Accessing variables set using SET /U or SET /S Support 3
D Force For to treat set of values as text, not files Support 3
vefatica Regular expressions in FOR's set? Support 10

Similar threads