This PR is specified by PowerShell / PowerShell-RFC #
Resolves # 192.
Implements && and
||
A statement like cmd1 && cmd2
should behave like
cmd1; if ($?) {cmd2} .
After discussion with the @ PowerShell / powershell-committee , this feature has the following charateristics:
cmd1 && cmd2
behaves like
cmd1; if ($?) {cmd2}
cmd1 || cmd2
behaves like cmd1; if (-not $?) {cmd2}
[cmd1 && cmd2] && cmd3
No control flow statements in pipeline chains; only pipelines . Control flow statements are still possible with subexpressions in pipelines ( cmd1 && $ (break) ). These were taken out due to the inconsitencies they posed at a grammatical, data structure and semantic level.
- Assignment is consistent with other assignment in PowerShell, so that a script terminating error will not result in a partial assignment, but a pipeline-terminating error will .
-
- This syntax is available as the
PSPipelineChainOperators
experimental feature
PR Checklist
PR has a meaningful title
Use the present tense and imperative mood when describing your changes.
Summarized changes
(Make sure all h , .cpp , . cs , . ps1 and . psm1 files have the correct copyright header
This PR is ready to merge and is not Work in Progress . If the PR is work in progress, please add the prefix WIP: or [ WIP ] to the beginning of the title (the bot will keep its status check at while the prefix is present) and remove the prefix when the PR is ready. Breaking changes None) OR Experimental feature. (s) needed
Experimental feature name (s): PSPipelineChainOperators
User-facing changes
Not Applicable
OR Documentation needed
Issue filed: (MicrosoftDocs / PowerShell-Docs #)
Testing - New and feature N / A or can only be interactively
(Read More
) 
GIPHY App Key not set. Please check settings