Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wait delay between executables

Status
Not open for further replies.

saqib11

Programmer
Jun 3, 2010
8
GB
Hi everyone,

I have a main code calling other executables. I need exe A to finish running before i start exe B, since exe B requires an output file (x) from A to be produced. How do i delay running B till A has completed and produced x?

I use call system (.....) to run these executables.

i cant check for the existence of the file x, because it always exists as i use the program many times so previous file x will just be used. I need to make sure that the system has run A and produced a new x before i run B.

Help!

Saqib
 
It depends on the implementation of SYSTEM. Some versions do not return until the process is finished. You could do it using batch files.

Assuming this is a windows system
Code:
del/q finished.txt
dosomething
echo finished > finished.txt

After running the system command, check for the presence of finished.txt. You can do something similar in DOS.
 
I ont know batch file operation well, could you explain how this works?

what do delq and dosomethng mean?

could you explain it to a dummy/

thanks

saqib
 
This is on windows

del fred.txt

will delete fred.txt. If the file does not exist you will get an error. If the file exists but cannot be deleted, it just hangs.

del/q fred.txt

/q means quiet. It doesn't complain if the cannot be deleted or does not exist.
 
to Gerritroot and xwb

so in xwb's example, what is the delete file part supposed to be used for? i dont want to delete, i want to copy a file once its created.

Gerritroot in your example, what does the /W mean and why am i using the start command?

again, im very new to all of this, and have only created that one batch file to move/copy files which geritroot advised me one a week or so ago

could one of you perhaps give me the few lines of bat file code as they would be for the problem i detailed initially with folders A and B and file x?

regards

saqib
 
/W means "Wait till executed"

You can check the working of any dos command giving the option "/?"

Try: "START /?" at the prompt and you'll see.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top