What does || do? What does && do?

August 27, 2011 at 18:44:08
Specs: Windows 7
I need to better understand || and &&

this poor example is just to show context...

ECHO %~1 was the first argument offered
ECHO %~1 | find "test1" >nul || goto test
<or what difference>
ECHO %~1 | find "test1" >nul && goto test

I'm trying to learn what these do and I've done some testing with examples found on this excellent forum but I'd love to have a plain explanation if someone would be so kind...

What does || do?
What does && do?
Where (reading source) should I learn more about these and related?
Hoow do these differ from just pipe and &?


See More: What does || do? What does && do?

Report •


#1
August 27, 2011 at 20:18:56
|| indicates that the following command should be executed only if the previous command failed.

&& indicates that the following command should be executed only if the previous command executed successfully.

See the Command Shell Overview linked here http://www.microsoft.com/resources/...


Please come back & tell us if your problem is resolved.


Report •

#2
August 27, 2011 at 20:23:43
Thanks for the reply and link, that's what I needed.

Report •

Related Solutions


Ask Question