|
Answer» windows xp 2002:
I'm using a batch file to launch other programs. I'd like the batch processing to stop until each program has completed before executing the NEXT command. For instance I will launch program Z which LEAVES several junk FILES in the folder when it's done. So, I would like the next command to DELETE the unwanted junk files. This isn't working now because the batch file launches program Z then immediately executes the delete command. Of course the junk files don't exist yet, so It's not doing what I need. Can you post the text of your batch file here?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 fileWelcome to the CH forums.
Try:
X.exe && del X_junk.* Y.exe && del Y_junk.* etc.......
See here for explanation of Conditional Execution.
Good luckQuote from: jim_999 on January 29, 2008, 01:33:07 PM When I run the batch file below, the programs X.exe, Y.exe, and Z.exe are all started in separate windows.
I don't use XP, so I can't say for sure if that is normal or not. But I don't think it is. At least not without the use of the start command, and your text of your batch file says that you are not using it.
I don't KNOW why you are getting separate windows. Based on your batch file, I would say that you would not.
QuoteWhat 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.
Which is exactly what your batch file looks like. That is, it runs line-by-line, in order.
|