For Command in windows batch

January 20, 2011 at 07:10:20
Specs: Windows 7, 4/16
How can I do a nest FOR command by piping the 2nd FOR statement

For /F "tokens=* delims= " %%A in ('net share|Find /I "Netlogon"') DO SET OUTPUT=%%A

For /F "tokens=* delims= " %%A in (%OUTPUT%) DO ECHO %%B

I tried piping the 1st command and add the 2nd for statement but it didn't work. I have to save the output of the 1st FOR statement to a variable and then run the 2nd FOR statement against the variable.

See More: For Command in windows batch

Report •

January 20, 2011 at 11:44:53
@echo off
net share|Find /I "Netlogon" > buffer.txt
For /F "tokens=* delims= " %%A in ('type buffer.txt') DO (
    ECHO %%A
del buffer.txt

May be if you tell us what you are trying to do we might be able to help.

Report •

January 22, 2011 at 12:39:59
Pipe and Goto Does not work inside loop.

Subhash Chandra.

Report •
Related Solutions

Ask Question