Databases Reference
In-Depth Information
The behavior of the Write - Debug cmdlet can also be controlled by the preference variable
$ DebugPreference . The default value of this variable is SilentlyContinue , i.e., debug messages
are not displayed. However, you can change its value to "Continue" , which displays debug messages
and continues with execution. Run the following commands (see Figure 3-43):
Set-PSDebug -Off
$DebugPreference
$DebugPreference = "Continue"
.\calculate-arith4.ps1 4 + 5
Figure 3-43
As shown in Figure 3-43, after the value of $DebugPreference changes from SilentlyContinue to
Continue , the debug messages from the calculate-arith4.ps1 script are printed out along with the
result.
Summary
This chapter illustrated various input and output methods, along with various programming elements
such as variables, expressions, operators, and loop constructs, in Windows PowerShell. It also illustrated
the various error-handling and debugging methods both inside PowerShell's interactive mode and inside
the scripts.
The next chapter continues to explore the programming side of subroutines, user profiles, and the sourc-
ing of scripts and functions.
Search WWH ::




Custom Search