The Watch window allows you to monitor environment variables, internal variables, variable functions, and user-defined functions, or to pause execution when a specified condition is met. The Watch window appears at the bottom of the debugger window. Enter the variable name or expression in the left column; the debugger will automatically display the current value in the right column. You can also add a variable to the Watch window by selecting it in the main debugger window, then clicking the right mouse button and selecting "Add to Watch". If the string in the left column is a single argument, it is assumed to be a variable name. Otherwise, it is assumed to be an expression. Expressions can be anything that IF can evaluate; for example:

 

%i = 3

ERRORLEVEL GT 12

 

Note that expressions require variable names to be prefixed by a %. If you're entering a single variable argument to monitor, do not use a %.

 

If you right click on the first column in the Watch window, the debugger will display an environment variable listbox. Select an entry to have it added to the watch list.

 

When the value of a monitored variable changes, the Watch window will change the text color to red.

 

The Watch tab default to always showing two variables:

 

%_?        The last TCC-RT internal command result

%?        The last ERRORLEVEL value

 

The watch windows has a toolbar, with the following buttons:

 

NewRestore the original values for the watch list
OpenAdd the contents of a file to the watch list
SaveSave the current watch list to a file
ApplyReplace the original values with the modified watch list
PrintPrint the current watch list
CutCopy the highlighted selection to the clipboard and delete it from the watch list
Copy Copy the highlighted selection to the clipboard
PasteCopy the contents of the clipboard to the current cursor location
DeleteDelete the highlighted selection (or the character at the cursor location if no selection)
UndoUndo the last edit
RedoRestore the last Undo
FindSearch for text
HelpDisplay the online help

 

The debugger will automatically save watch lists (the current batch file name + ".watch"), and reload them the next time the batch file is loaded in the debugger.