For batchfiles or functions of any size, I try to include debugging messages. Many take a '/D' (or -D) argument to turn on debugging or just relay on the environment variable 'DEBUG' to be defined.
Therefore, I created this simple function so I can put this in the code and the function will decide if a message should be printed. It then will display it in RED and prefix the text with "DEBUG: "
Therefore, I created this simple function so I can put this in the code and the function will decide if a message should be printed. It then will display it in RED and prefix the text with "DEBUG: "
Code:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: DebugPrint
::
:: Simple command to display an error message in RED with a DEBUG
:: before it. Very useful in scripts.
::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DebugPrint {
iff defined Debug then
SetColor RED
echo DEBUG: %@Unquote[%1]
SetColor NORMAL
endiff
}