scripting - Use command output for "if then else" in batch file -
i want run command , use result "if then" statement
schtasks /query /s server /fo list /tn "task" | find /c "running"
i'm hitting roadblock on how manage though.
normal output command either 0
or 3
.
need able "if result 0 goto " or along lines.
any suggestions?
the command for preferred method output lines of command variable further processing. run in command prompt window for /?
details on command.
for /f %%i in ('%systemroot%\system32\schtasks.exe /query /s server /fo list /tn "task" ^| %systemroot%\system32\find.exe /c "running"') if "%%i" == "0" goto :eof
the pipe operator |
must escaped ^
applied command schtasks , not resulting in syntax error because of applying command for.
Comments
Post a Comment