How do we interactively Debug a script with no user input?
Take the following sample of code:
;*************************************************************************************
; Check the following key for W2k Machines to make the window not run minimized
;*************************************************************************************
IF @dos = 5.0
$hklms = $HKLMS = 'HKEY_LOCAL_MACHINE\SOFTWARE'
$debug_mode="no" ; - yes/no - no = no user output will be viewed
IF 1 <> ReadValue($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync")
IF $debug_mode="no"
; -- This will display nothing on the screen (suppressed)
$ = WriteValue ($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync", "1", "REG_DWORD")
ELSE
; -- This will display a 0 on the screen for successful Registry Write
WriteValue ($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync", "1", "REG_DWORD")
; -- Wait a couple of seconds to verify the results
SLEEP 2
ENDIF
ENDIF
ENDIF
So, What did we do here?
Added a variable - $debug_mode
If set to no, no visible results returned to the user. If set to Yes, there are visible results returned to the user and a two-second SLEEP (pause) is also added for verification.