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 internal command result
%? The last ERRORLEVEL value
The watch windows has a toolbar, with the following buttons:
|New||Restore the original values for the watch list|
|Open||Add the contents of a file to the watch list|
|Save||Save the current watch list to a file|
|Apply||Replace the original values with the modified watch list|
|Print the current watch list|
|Cut||Copy the highlighted selection to the clipboard and delete it from the watch list|
|Copy||Copy the highlighted selection to the clipboard|
|Paste||Copy the contents of the clipboard to the current cursor location|
|Delete||Delete the highlighted selection (or the character at the cursor location if no selection)|
|Undo||Undo the last edit|
|Redo||Restore the last Undo|
|Find||Search for text|
|Help||Display 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.