When I run the batch file below, the programs X.exe, Y.exe, and Z.exe are all started in separate windows. The del commands are executed immediately with no junk files created yet. So there's nothing to delete.
What I want is (1) run X.exe and wait until it's done (2) delete junk files from X.exe (3) run Y.exe and wait until it's done (4) delete junk files from Y.exe....so on.
The batch file looks like this:
rem start batch file:
X.exe
del Z_junk.*
Y.exe
del Y_junk.*
Z.exe
del Z_junk.*
rem end of batch file