Skip to content

Commit

Permalink
add terms to no-loc and add new example (#11234)
Browse files Browse the repository at this point in the history
Add missing metadata to no-loc for CommandWithArgs, and fix example for launching from cmd.exe
  • Loading branch information
ninmonkey committed Jul 4, 2024
1 parent 7ea0d42 commit 98465fb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
22 changes: 21 additions & 1 deletion reference/7.4/Microsoft.PowerShell.Core/About/about_Pwsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: Explains how to use the `pwsh` command-line interface. Displays the command-line parameters and describes the syntax.
Locale: en-US
ms.date: 01/10/2024
no-loc: [-File, -f, -Command, -c, -ConfigurationName, -config, -CustomPipeName, -EncodedCommand, -e, -ec, -ExecutionPolicy, -ex, -ep, -InputFormat, -inp, -if, -Interactive, -i, -Login, -l, -MTA, -NoExit, -noe, -NoLogo, -nol, -NonInteractive, -noni, -NoProfile, -nop, -OutputFormat, -o, -of, -SettingsFile, -settings, -SSHServerMode, -sshs, -STA, -Version, -v, -WindowStyle, -w, -WorkingDirectory, -wd, -Help]
no-loc: [-File, -f, -Command, -c, -CommandWithArgs, -cwa, -ConfigurationName, -config, -CustomPipeName, -EncodedCommand, -e, -ec, -ExecutionPolicy, -ex, -ep, -InputFormat, -inp, -if, -Interactive, -i, -Login, -l, -MTA, -NoExit, -noe, -NoLogo, -nol, -NonInteractive, -noni, -NoProfile, -nop, -OutputFormat, -o, -of, -SettingsFile, -settings, -SSHServerMode, -sshs, -STA, -Version, -v, -WindowStyle, -w, -WorkingDirectory, -wd, -Help]
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pwsh?view=powershell-7.4&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Pwsh
Expand Down Expand Up @@ -221,6 +221,25 @@ arg: arg1
arg: arg2
```

> [!NOTE]
> [Argument parsing with quotes][05] causes the example to fail if ran from
> `cmd.exe` or `powershell.exe`. To run from those, you can use
```powershell
# When ran from cmd.exe
pwsh -CommandWithArgs "$args | % { ""arg: $_"" }" arg1 arg2
# when ran from pwsh.exe
pwsh -CommandWithArgs '$args | % { "arg: $_" }' arg1 arg2
# when ran from powershell.exe
pwsh -CommandWithArgs '"$args | % { ""arg: $_"" }"' arg1 arg2
# when ran from pwsh.exe with legacy argument passing
$PSNativeCommandArgumentPassing = 'Legacy'
pwsh -CommandWithArgs '$args | % { ""arg: $_"" }' arg1 arg2
```

### -ConfigurationName | -config

Specifies a configuration endpoint in which PowerShell is run. This can be any
Expand Down Expand Up @@ -410,3 +429,4 @@ prepend the command parameters with a hyphen (`-`), not a forward slash (`/`).
[02]: about_Automatic_Variables.md#lastexitcode
[03]: about_operators.md#special-operators
[04]: https://linux.die.net/man/1/chsh
[05]: about_Parsing.md#passing-arguments-that-contain-quote-characters
22 changes: 21 additions & 1 deletion reference/7.5/Microsoft.PowerShell.Core/About/about_Pwsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description: Explains how to use the `pwsh` command-line interface. Displays the command-line parameters and describes the syntax.
Locale: en-US
ms.date: 01/10/2024
no-loc: [-File, -f, -Command, -c, -ConfigurationName, -config, -CustomPipeName, -EncodedCommand, -e, -ec, -ExecutionPolicy, -ex, -ep, -InputFormat, -inp, -if, -Interactive, -i, -Login, -l, -MTA, -NoExit, -noe, -NoLogo, -nol, -NonInteractive, -noni, -NoProfile, -nop, -OutputFormat, -o, -of, -SettingsFile, -settings, -SSHServerMode, -sshs, -STA, -Version, -v, -WindowStyle, -w, -WorkingDirectory, -wd, -Help]
no-loc: [-File, -f, -Command, -c, -CommandWithArgs, -cwa, -ConfigurationName, -config, -CustomPipeName, -EncodedCommand, -e, -ec, -ExecutionPolicy, -ex, -ep, -InputFormat, -inp, -if, -Interactive, -i, -Login, -l, -MTA, -NoExit, -noe, -NoLogo, -nol, -NonInteractive, -noni, -NoProfile, -nop, -OutputFormat, -o, -of, -SettingsFile, -settings, -SSHServerMode, -sshs, -STA, -Version, -v, -WindowStyle, -w, -WorkingDirectory, -wd, -Help]
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_pwsh?view=powershell-7.5&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Pwsh
Expand Down Expand Up @@ -221,6 +221,25 @@ arg: arg1
arg: arg2
```

> [!NOTE]
> [Argument parsing with quotes][05] causes the example to fail if ran from
> `cmd.exe` or `powershell.exe`. To run from those, you can use
```powershell
# When ran from cmd.exe
pwsh -CommandWithArgs "$args | % { ""arg: $_"" }" arg1 arg2
# when ran from pwsh.exe
pwsh -CommandWithArgs '$args | % { "arg: $_" }' arg1 arg2
# when ran from powershell.exe
pwsh -CommandWithArgs '"$args | % { ""arg: $_"" }"' arg1 arg2
# when ran from pwsh.exe with legacy argument passing
$PSNativeCommandArgumentPassing = 'Legacy'
pwsh -CommandWithArgs '$args | % { ""arg: $_"" }' arg1 arg2
```

### -ConfigurationName | -config

Specifies a configuration endpoint in which PowerShell is run. This can be any
Expand Down Expand Up @@ -410,3 +429,4 @@ prepend the command parameters with a hyphen (`-`), not a forward slash (`/`).
[02]: about_Automatic_Variables.md#lastexitcode
[03]: about_operators.md#special-operators
[04]: https://linux.die.net/man/1/chsh
[05]: about_Parsing.md#passing-arguments-that-contain-quote-characters

0 comments on commit 98465fb

Please sign in to comment.