cmd.exe /C start calc.exe > NUL 2> NUL
echo This line is shown immediately!
cmd.exe /C start calc.exe > NUL 2> NUL | find "Parsing whole output"
echo This line won't execute until second calc.exe is closed! Why???
How do I start a background application from cmd.exe so that cmd's output is immediately closed after exit (ignoring child state and its output)?
Cmd's output is processed, but I don't care about child's process output.
Definitions
- parent - a script or program that invokes a child and consumes its output
- child - a cmd command or batch file optionally producing some output
- grandchild - a program that is invoked by a child and is left running forever
Parent and grandchild have fixed semantics and are out of this question scope. I'm trying to create a child.
Acceptance criteria
Write a child batch script that, if invoked with:
REM This is a parent
call child.cmd | find "something"
echo "Accepted!"
- leaves calc.exe grandchild running forever
- returns immediately, letting echo directive execute