Options

Is there a || equivalent in PoSH?

sambuca69sambuca69 Member Posts: 262
If I was writing a batch script I could use || to kick off a second command, if the first command failed.

Anyone know offhand, if there is an equivalent in PowerShell?

Comments

  • Options
    RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
    sambuca69 wrote: »
    If I was writing a batch script I could use || to kick off a second command, if the first command failed.

    Anyone know offhand, if there is an equivalent in PowerShell?

    I don't believe this is likely. I've never seen anything like that. The same thing can be done with try/catch, which would give you better ways of knowing why the command failed (a DNS error versus the path to the folder was not found) and then reacting to it depending on why.
Sign In or Register to comment.