5.5. Preference Variables
You can control some aspects of PowerShell by using preference variables. A preference variable is a variable whose value allows you to express a preference about how PowerShell should behave in a specified situation. For example, the value of the $ErrorActionPreference variable allows you to specify how PowerShell should behave if an error is encountered.
To see the preference variables on your system, use all of the following commands:
getvariable:*preference* getvariable:maximum* getvariable:report*
Figure 5-19 shows the results of running the preceding commands.
Figure 5.19. Figure 5-19
![](/api/v2/epubs/9780471946939/files/9780471946939_preference_variables_image01.png)
As you can see in Figure 5-19, all preference variables and their current values can be displayed using simple commands. If, however, you want to see the value of a specified preference variable, simply type its name on the command line. For example, to see the current value of the $ErrorActionPreference variable, simply type
$ErrorActionPreference
on the command line. The value of the preference variable is then displayed.
Get Professional Windows® PowerShell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.