Please feel free to provide feedback or file bugs here.

Implement the && and || operators that bash has

Votes from Connect: 22

Original Date Submitted: 2/8/2013 8:32:38 AM

Description:
********Contact Information********
Handle: antize
Site Name: PowerShell
Feedback ID: 778798
***************************************

Frequency: Always Happens
Regression: Yes, this happens in all previous versions

Problem Description:
Discussion about this at stackoverflow - http://stackoverflow.com/questions/563600/can-i-get-to-work-in-powershell

Jeffery Snover said to request it here so here I am :D

Here is a description of what they do -- http://www.gnu.org/software/bash/manual/bashref.html#Lists

An AND list has the form
command1 && command2

command2 is executed if, and only if, command1 returns an exit status of zero.

An OR list has the form
command1 || command2

command2 is executed if, and only if, command1 returns a non-zero exit status.

Product Studio item created by Connect Synchronizer due to creation of feedback ID 778798 (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=778798).

Repro Steps:
Expected Results:

Internal BugId: 4111

79 votes
Sign in
(thinking…)
Password icon
Signed in as (Sign out)

We’ll send you updates on this idea

AdminJoey Aiello [MSFT] (Program Manager, Windows Server) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

2 comments

Sign in
(thinking…)
Password icon
Signed in as (Sign out)
Submitting...
  • Anonymous commented  ·   ·  Flag as inappropriate

    It's surely an overisght since I used this simple one line shorthand alternative to an if clause all the time in CMD scripts.

  • John B. commented  ·   ·  Flag as inappropriate

    They are both in command prompt (cmd.exe), as well. Great shorthand I wish PowerShell had.

Feedback and Knowledge Base