#1 09 Oct 2018 16:54

dbenham
Member
From: U.S. east coast
Registered: 15 Apr 2012
Posts: 111

Error in "Conditional Execution" documentation

The following claim at https://ss64.com/nt/syntax-conditional.html is incorrect

SS64 Documentation wrote:

Use parenthesis to test the success of several commands:

(Dir C:\Test1 & Dir C:\Test2) || Echo One or more of the commands failed.

Actually the ECHO will only fire if the 2nd DIR fails.

The logic can be corrected by using && instead of &, but then the code short circuits - The 2nd DIR will not run if the 1st one fails

(Dir C:\Test1 && Dir C:\Test2) || echo One of the DIR commands failed.

And the parentheses are not required. The exact same logic is achieved by

Dir C:\Test1 && Dir C:\Test2 || echo One of the DIR commands failed.

The documentation problem was brought to my attention at https://stackoverflow.com/q/52724068/1012053


Dave Benham

Last edited by dbenham (09 Oct 2018 17:24)

Offline

#2 09 Oct 2018 18:17

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 977
Website

Re: Error in "Conditional Execution" documentation

Thanks Dave, I have updated the page now

Offline

#3 09 Oct 2018 22:00

dbenham
Member
From: U.S. east coast
Registered: 15 Apr 2012
Posts: 111

Re: Error in "Conditional Execution" documentation

Almost tongue

You have a "dirst" DIR instead of first DIR

Offline

#4 10 Oct 2018 00:19

Simon Sheppard
Super Administrator
Registered: 27 Aug 2005
Posts: 977
Website

Re: Error in "Conditional Execution" documentation

fixed now, thanks again Dave

Offline

Board footer

Powered by FluxBB