This is a minimal example that illustrates my problem:
:: test.bat
@echo off
call test2.bat 2>&1 | findstr foo
echo done calling test2
:: test2.bat
@echo off
start /B notepad >NUL
echo done starting child process
In this sample, findstr will not complete until notepad is closed, presumably because notepad has inherited stdout from the parent cmd process. How can I modify test2.bat so that test.bat doesn't hang?