22description : >
33 This article shows how to run commands in PowerShell.
44title : Running commands in the shell
5- ms.date : 11/21 /2025
5+ ms.date : 12/01 /2025
66---
77# Running commands in the shell
88
@@ -70,17 +70,17 @@ adjust how you pass those strings.
7070
7171For more information, see the following articles:
7272
73- - [ about_Parsing] [ 1 ]
74- - [ about_Quoting_Rules] [ 2 ]
73+ - [ about_Parsing] [ 03 ]
74+ - [ about_Quoting_Rules] [ 06 ]
7575
7676PowerShell 7.2 introduced a new experimental feature ` PSNativeCommandArgumentPassing ` that improved
77- native command handling. For more information, see [ ` $PSNativeCommandArgumentPassing ` ] [ 3 ] .
77+ native command handling. For more information, see [ ` $PSNativeCommandArgumentPassing ` ] [ 04 ] .
7878
7979### Handling output and errors
8080
8181PowerShell also has several more output streams than other shells. The ` bash ` and ` cmd.exe ` shells
8282have ** stdout** and ** stderr** . PowerShell has six output streams. For more information, see
83- [ about_Redirection] [ 4 ] and [ about_Output_Streams] [ 5 ] .
83+ [ about_Redirection] [ 07 ] and [ about_Output_Streams] [ 02 ] .
8484
8585In general, the output sent to ** stdout** by a native command is sent to the ** Success** stream in
8686PowerShell. Output sent to ** stderr** by a native command is sent to the ** Error** stream in
@@ -98,8 +98,8 @@ behavior can cause confusion in PowerShell when looking through errors and the a
9898information can be lost if ` $ErrorActionPreference ` is set to a state that mutes the output.
9999
100100PowerShell 7.3 added a new experimental feature ` PSNativeCommandErrorActionPreference ` that allows
101- you to control whether output to ` stderr ` is treated as an error . For more information, see
102- [ ` $PSNativeCommandUseErrorActionPreference ` ] [ 6 ] .
101+ you to control how you handle non-zero exit codes from native commands . For more information, see
102+ [ ` $PSNativeCommandUseErrorActionPreference ` ] [ 05 ] .
103103
104104## Running PowerShell commands
105105
@@ -112,7 +112,7 @@ the PowerShell scripting language itself.
112112The PowerShell ** call operator** (` & ` ) lets you run commands that are stored in variables and
113113represented by strings or script blocks. You can use the operator to run any native command or
114114PowerShell command. This is useful in a script when you need to dynamically construct the
115- command-line parameters for a native command. For more information, see the [ call operator] [ 7 ] .
115+ command-line parameters for a native command. For more information, see the [ call operator] [ 01 ] .
116116
117117The ` Start-Process ` cmdlet can be used to run native commands, but should only be used when you need
118118to control how the command is executed. The cmdlet has parameters to support the following
@@ -136,7 +136,7 @@ $processOptions = @{
136136Start-Process @processOptions
137137```
138138
139- For more information, see [ Start-Process] [ 8 ] .
139+ For more information, see [ Start-Process] [ 09 ] .
140140
141141On Windows, the ` Invoke-Item ` cmdlet performs the default action for the specified item. For
142142example, it runs an executable file or opens a document file using the application associated with
@@ -149,15 +149,15 @@ The following example opens the PowerShell source code repository in your defaul
149149Invoke-Item https://github.com/PowerShell/PowerShell
150150```
151151
152- For more information, see [ Invoke-Item] [ 9 ] .
152+ For more information, see [ Invoke-Item] [ 08 ] .
153153
154154<!-- link references -->
155- [ 1 ] : /powershell/module/microsoft.powershell.core/about/about_parsing#passing-arguments-to-native
156- [ 2 ] : /powershell/module/microsoft.powershell.core/about/about_quoting_rules
157- [ 3 ] : /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing
158- [ 4 ] : /powershell/module/microsoft.powershell.core/about/about_redirection
159- [ 5 ] : /powershell/module/microsoft.powershell.core/about/about_output_streams
160- [ 6 ] : /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommanduseerroractionpreference
161- [ 7 ] : /powershell/module/microsoft.powershell.core/about/about_operators#call-operator-
162- [ 8 ] : /powershell/module/microsoft.powershell.management/start-process
163- [ 9 ] : /powershell/module/microsoft.powershell.management/invoke-item
155+ [ 01 ] : /powershell/module/microsoft.powershell.core/about/about_operators#call-operator-
156+ [ 02 ] : /powershell/module/microsoft.powershell.core/about/about_output_streams
157+ [ 03 ] : /powershell/module/microsoft.powershell.core/about/about_parsing#passing-arguments-to-native
158+ [ 04 ] : /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommandargumentpassing
159+ [ 05 ] : /powershell/module/microsoft.powershell.core/about/about_preference_variables#psnativecommanduseerroractionpreference
160+ [ 06 ] : /powershell/module/microsoft.powershell.core/about/about_quoting_rules
161+ [ 07 ] : /powershell/module/microsoft.powershell.core/about/about_redirection
162+ [ 08 ] : /powershell/module/microsoft.powershell.management/invoke-item
163+ [ 09 ] : /powershell/module/microsoft.powershell.management/start-process
0 commit comments