You are not logged in.

#1 28 Mar 2014 15:31

neodoughnut
New Member
Registered: 28 Mar 2014
Posts: 4

Double Piping/Redirection in FOR /F Command ||

Hello everyone,

I have been using this for a while and its been a great reference.

I was just wondering what would the correct syntax to use for below:

FOR %a in ('wmic NODE:%name% computersystem get username || echo failed') DO echo %a

I have no problems using a single pipe and caret ^| in the statement above, but when I insert two I get:

|| was unexpected at this time.


Any help would be much appreciated.

Cheers

Steve

Offline

#2 28 Mar 2014 16:00

bluesxman
Member
From: UK
Registered: 29 Dec 2006
Posts: 1,129

Re: Double Piping/Redirection in FOR /F Command ||

Not sure what you've tried, but this should do it...

FOR /f %a in ('wmic NODE:%name% computersystem get username ^|^| echo failed') DO echo %a

cmd | *sh | ruby | chef

Offline

#3 28 Mar 2014 16:16

neodoughnut
New Member
Registered: 28 Mar 2014
Posts: 4

Re: Double Piping/Redirection in FOR /F Command ||

It works! Thank you very much. I owe you a pint smile

Offline

Board footer

Powered by