Skip to content

Commit f586a98

Browse files
author
Sean Wheeler
authored
fixing backlashes reported in PR1921 (#1924)
* fixing backlashes reported in PR1921 * found more backslashes
1 parent 96504e3 commit f586a98

File tree

5 files changed

+235
-235
lines changed

5 files changed

+235
-235
lines changed

reference/3.0/Microsoft.PowerShell.Core/About/about_Preference_Variables.md

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
ms.date: 2017-06-09
2+
ms.date: 2017-12-05
33
schema: 2.0.0
44
locale: en-us
55
keywords: powershell,cmdlet
@@ -248,7 +248,7 @@ debug message is not displayed and processing continues. The final command
248248
uses the Debug parameter to override the preference for a single command.
249249

250250
```powershell
251-
PS> $debugpreference # Get the current value of \$DebugPreference
251+
PS> $debugpreference # Get the current value of $DebugPreference
252252
SilentlyContinue
253253
254254
PS> write-debug "Hello, World"
@@ -301,7 +301,7 @@ uses the Debug parameter with a value of \$false to suppress the message for
301301
a single command.
302302

303303
```powershell
304-
PS> \$debugpreference = "Inquire"
304+
PS> $debugpreference = "Inquire"
305305
PS> write-debug "Hello, World"
306306
DEBUG: Hello, World
307307
@@ -375,7 +375,7 @@ This example shows the effect of the SilentlyContinue value.
375375

376376
```powershell
377377
PS> # Change the value of the preference.
378-
PS> \$ErrorActionPreference = "SilentlyContinue"
378+
PS> $ErrorActionPreference = "SilentlyContinue"
379379
380380
PS> # Generate an error message.
381381
PS> write-error "Hello, World"
@@ -393,14 +393,14 @@ a non-existent file, nofile.txt. The example also uses the ErrorAction common
393393
parameter to override the preference.
394394

395395
```powershell
396-
PS> \$erroractionpreference
396+
PS> $erroractionpreference
397397
SilentlyContinue # Display the value of the preference.
398398
399399
PS> get-childitem -path nofile.txt
400400
PS> # Error message is suppressed.
401401
402402
PS> # Change the value to Continue.
403-
PS> \$ErrorActionPreference = "Continue"
403+
PS> $ErrorActionPreference = "Continue"
404404
405405
PS> get-childitem -path nofile.txt
406406
Get-ChildItem : Cannot find path 'C:\nofile.txt' because it does not exist.
@@ -412,7 +412,7 @@ PS> get-childitem -path nofile.txt -erroraction SilentlyContinue
412412
PS> # Error message is suppressed.
413413
414414
PS> # Change the value to Inquire.
415-
PS> \$ErrorActionPreference = "Inquire"
415+
PS> $ErrorActionPreference = "Inquire"
416416
PS> get-childitem -path nofile.txt
417417
418418
Confirm
@@ -425,7 +425,7 @@ At line:1 char:4
425425
+ get-childitem <<<< nofile.txt
426426
427427
PS> # Change the value to Continue.
428-
PS> \$ErrorActionPreference = "Continue"
428+
PS> $ErrorActionPreference = "Continue"
429429
PS> Get-Childitem nofile.txt -erroraction "Inquire"
430430
PS> # Use the ErrorAction parameter to override the preference value.
431431
@@ -462,7 +462,7 @@ NormalView. In this case, the Get-ChildItem command is used to find a
462462
non-existent file.
463463

464464
```powershell
465-
PS> \$ErrorView # Verify the value.
465+
PS> $ErrorView # Verify the value.
466466
NormalView
467467
468468
PS> get-childitem nofile.txt # Find a non-existent file.
@@ -475,7 +475,7 @@ This example shows how the same error appears when the value of
475475
\$ErrorView is CategoryView.
476476

477477
```powershell
478-
PS> \$ErrorView = "CategoryView" # Change the value to
478+
PS> $ErrorView = "CategoryView" # Change the value to
479479
CategoryView
480480
481481
PS> get-childitem nofile.txt
@@ -493,7 +493,7 @@ error in the error array (element 0) and formats all of the properties of the
493493
error object in a list.
494494

495495
```powershell
496-
PS> \$error[0] | format-list -property * -force
496+
PS> $error[0] | format-list -property * -force
497497
498498
Exception : System.Management.Automation.ItemNotFoundException: Cannot
499499
find path 'C:\nofile.txt' because it does not exist.
@@ -546,10 +546,10 @@ In the resulting display, the list in the Group column is now limited by the
546546
line length. In the final command in the example, use the Wrap parameter of
547547
Format-Table to display all of the processes in each Status group.
548548

549-
PS> \$formatenumerationlimit # Find the current value
549+
```powershell
550+
PS> $formatenumerationlimit # Find the current value
550551
4
551552
552-
```powershell
553553
PS> # List all services grouped by status
554554
PS> get-service | group-object -property status
555555
@@ -560,7 +560,7 @@ Count Name Group
560560
PS> # The list is truncated after 4 items.
561561
562562
PS> # Increase the limit to 1000.
563-
PS> \$formatenumerationlimit = 1000
563+
PS> $formatenumerationlimit = 1000
564564
PS> get-service | group-object -property status
565565
566566
Count Name Group
@@ -650,20 +650,20 @@ The Log*Event preference variables are as follows:
650650
To enable a Log*Event, type the variable with a value of \$true, for example:
651651

652652
```powershell
653-
\$LogCommandLifeCycleEvent
653+
$LogCommandLifeCycleEvent
654654
```
655655

656656
- or -
657657

658658
```powershell
659-
\$LogCommandLifeCycleEvent = \$true
659+
$LogCommandLifeCycleEvent = $true
660660
```
661661

662662
To disable an event type, type the variable with a value of \$false, for
663663
example:
664664

665665
```powershell
666-
\$LogCommandLifeCycleEvent = \$false
666+
$LogCommandLifeCycleEvent = $false
667667
```
668668

669669
The events that you enable are effective only for the current PowerShell
@@ -719,26 +719,26 @@ To count the errors on your system, use the Count property of the \$Error
719719
array. Type:
720720

721721
```powershell
722-
\$Error.count
722+
$Error.count
723723
```
724724

725725
To display a specific error, use array notation to display the error. For
726726
example, to see the most recent error, type:
727727

728728
```powershell
729-
\$Error[0]
729+
$Error[0]
730730
```
731731

732732
To display the oldest retained error, type:
733733

734734
```powershell
735-
\$Error[(\$Error.Count -1]
735+
$Error[($Error.Count -1]
736736
```
737737

738738
To display the properties of the ErrorRecord object, type:
739739

740740
```powershell
741-
\$Error[0] | format-list -property * -force
741+
$Error[0] | format-list -property * -force
742742
```
743743

744744
In this command, the Force parameter overrides the special formatting of
@@ -748,11 +748,11 @@ To delete all errors from the error history, use the Clear method of the error
748748
array.
749749

750750
```powershell
751-
PS> \$Error.count
751+
PS> $Error.count
752752
17
753-
PS> \$Error.clear()
753+
PS> $Error.clear()
754754
PS>
755-
PS> \$Error.count
755+
PS> $Error.count
756756
0
757757
```
758758

@@ -844,19 +844,19 @@ is converted to a string. In this case, an array of integers is stored in a
844844
variable and then the variable is cast as a string.
845845

846846
```powershell
847-
PS> \$array = 1,2,3 # Store an array of integers.
847+
PS> $array = 1,2,3 # Store an array of integers.
848848
849-
PS> [string]\$array # Cast the array to a string.
849+
PS> [string]$array # Cast the array to a string.
850850
1 2 3 # Spaces separate the elements
851851
```
852852

853853
To change the separator, add the \$OFS variable by assigning a value to it.
854854
To work correctly, the variable must be named \$OFS.
855855

856856
```powershell
857-
PS> \$OFS = "+" # Create \$OFS and assign a "+"
857+
PS> $OFS = "+" # Create $OFS and assign a "+"
858858
859-
PS> [string]\$array # Repeat the command
859+
PS> [string]$array # Repeat the command
860860
1+2+3 # Plus signs separate the elements
861861
```
862862

@@ -865,10 +865,10 @@ To restore the default behavior, you can assign a space (" ") to the value of
865865
verifies that the separator is a space.
866866

867867
```powershell
868-
PS> Remove-Variable OFS # Delete \$OFS
868+
PS> Remove-Variable OFS # Delete $OFS
869869
PS>
870870
871-
PS> [string]\$array # Repeat the command
871+
PS> [string]$array # Repeat the command
872872
1 2 3 # Spaces separate the elements
873873
```
874874

@@ -897,7 +897,7 @@ The first command finds the value of \$OutputEncoding. Because the value is an
897897
encoding object, display only its EncodingName property.
898898

899899
```powershell
900-
PS> \$OutputEncoding.EncodingName # Find the current value US-ASCII
900+
PS> $OutputEncoding.EncodingName # Find the current value US-ASCII
901901
```
902902

903903
In this example, a FINDSTR command is used to search for two Chinese
@@ -918,9 +918,9 @@ locale selected for Windows. Because OutputEncoding is a static property of
918918
the console, use double-colons (::) in the command.
919919

920920
```powershell
921-
PS> \$OutputEncoding = [console]::outputencoding
921+
PS> $OutputEncoding = [console]::outputencoding
922922
PS> # Set the value equal to the OutputEncoding property of the console.
923-
PS> \$OutputEncoding.EncodingName
923+
PS> $OutputEncoding.EncodingName
924924
OEM United States
925925
```
926926
As a result of this change, the FINDSTR command finds the characters.
@@ -1100,7 +1100,7 @@ values you prefer. Save the output in a variable called \$PSSessionOption.
11001100
For example,
11011101

11021102
```powershell
1103-
\$PSSessionOption = New-PSSessionOption -NoCompression
1103+
$PSSessionOption = New-PSSessionOption -NoCompression
11041104
```
11051105

11061106
To use the \$PSSessionOption preference variable in every PowerShell session,
@@ -1202,7 +1202,7 @@ This example shows the effect of the Inquire value.
12021202

12031203
```powershell
12041204
PS> # Change the value to Inquire.
1205-
PS> \$VerbosePreference = "Inquire"
1205+
PS> $VerbosePreference = "Inquire"
12061206
PS> Write-Verbose "Verbose message test."
12071207
VERBOSE: Verbose message test.
12081208
Confirm
@@ -1249,7 +1249,7 @@ value.
12491249
This example shows the effect of the Continue value, which is the default.
12501250

12511251
```powershell
1252-
PS> \$WarningPreference # Find the current value.
1252+
PS> $WarningPreference # Find the current value.
12531253
Continue
12541254
PS> Write-Warning "This action can delete data."
12551255
WARNING: This action can delete data.
@@ -1263,7 +1263,7 @@ This example shows the effect of the SilentlyContinue value.
12631263

12641264
```powershell
12651265
PS> # Change the value to SilentlyContinue.
1266-
PS> \$WarningPreference = "SilentlyContinue"
1266+
PS> $WarningPreference = "SilentlyContinue"
12671267
PS> Write-Warning "This action can delete data."
12681268
PS> # Write a warning message.
12691269
@@ -1280,7 +1280,7 @@ This example shows the effect of the Inquire value.
12801280

12811281
```powershell
12821282
PS> # Change the value to Inquire.
1283-
PS> \$WarningPreference = "Inquire"
1283+
PS> $WarningPreference = "Inquire"
12841284
PS> Write-Warning "This action can delete data."
12851285
WARNING: This action can delete data.
12861286
@@ -1299,7 +1299,7 @@ This example shows the effect of the Stop value.
12991299

13001300
```powershell
13011301
PS> # Change the value to Stop.
1302-
PS> \$WarningPreference = "Stop"
1302+
PS> $WarningPreference = "Stop"
13031303
13041304
PS> Write-Warning "This action can delete data."
13051305
WARNING: This action can delete data.
@@ -1360,7 +1360,7 @@ This example shows the effect of the 0 (not enabled) value, which is the
13601360
default.
13611361

13621362
```powershell
1363-
PS> \$whatifpreference
1363+
PS> $whatifpreference
13641364
0 # Check the current value.
13651365
13661366
PS> # Verify that the file exists.
@@ -1400,8 +1400,8 @@ Remove-Item to delete a cmdlet, Remove-Item displays the path to the file that
14001400
it would delete, but it does not delete the file.
14011401

14021402
```powershell
1403-
PS> \$whatifpreference = 1
1404-
PS> \$whatifpreference
1403+
PS> $whatifpreference = 1
1404+
PS> $whatifpreference
14051405
1 # Change the value.
14061406
14071407
PS> # Try to delete a file.
@@ -1417,8 +1417,8 @@ This example shows how to delete a file when the value of \$WhatIfPreference
14171417
is 1. It uses the WhatIf parameter with a value of \$false.
14181418

14191419
```powershell
1420-
PS> # Use the WhatIf parameter with \$false.
1421-
PS> remove-item test.txt -whatif:\$false
1420+
PS> # Use the WhatIf parameter with $false.
1421+
PS> remove-item test.txt -whatif:$false
14221422
```
14231423

14241424
This example demonstrates that some cmdlets support WhatIf behavior and others
@@ -1430,7 +1430,7 @@ a value of \$false.
14301430

14311431
```powershell
14321432
PS> # Change the value to 1.
1433-
PS> \$whatifpreference = 1
1433+
PS> $whatifpreference = 1
14341434
14351435
PS> get-process winword
14361436
A Get-Process command completes.
@@ -1443,8 +1443,8 @@ PS> # A Stop-Process command uses WhatIf.
14431443
PS> stop-process -name winword
14441444
What if: Performing operation "Stop-Process" on Target "WINWORD (2312)".
14451445
1446-
PS> stop-process -name winword -whatif:\$false
1447-
PS> # WhatIf:\$false overrides the preference.
1446+
PS> stop-process -name winword -whatif:$false
1447+
PS> # WhatIf:$false overrides the preference.
14481448
14491449
PS> # Verify that the process is stopped.
14501450
PS> get-process winword

0 commit comments

Comments
 (0)