是否可以在批处理文件中使用管道stdin流?
我希望能够将一个命令的输出重定向到我的批处理文件process.bat列表中,这样:
C:\>someOtherProgram.exe | process.bat
Run Code Online (Sandbox Code Playgroud)
我的第一次尝试看起来像:
echo OFF
setlocal
:again
set /p inputLine=""
echo.%inputLine%
if not (%inputLine%)==() goto again
endlocal
:End
Run Code Online (Sandbox Code Playgroud)
当我用type testFile.txt | process.bat它测试时,它会反复打印出第一行.
还有另外一种方法吗?