Computer Hope

Microsoft => Microsoft Windows => Windows Server => Topic started by: pvignesh92 on July 25, 2012, 09:14:05 PM

Title: Issue in batch file execution in Windows 2008 server
Post by: pvignesh92 on July 25, 2012, 09:14:05 PM
Hello guys,

Need your expert advice in this. I have been facing issue in a cmd file. I was executing some set of command in a batch file. I want the second command execute after the first command completes.

My scenario

1st cmd :start tdpexcc - will execute the backup of an exchange DB ( backup ll run at the background)

2nd cmd : tail - 20 output of backup completion status to another file

What happens is the second cmd executes even before the process started by first command completes. Kindly help me in resolving this

Thanks
Title: Re: Issue in batch file execution in Windows 2008 server
Post by: DaveLembke on July 26, 2012, 06:20:27 AM
I'd add a delay in between both instructions using SLEEP. I haven't tested SLEEP on Server 2008 but it worked on 2000 and 2003 servers when added.
Title: Re: Issue in batch file execution in Windows 2008 server
Post by: Squashman on July 26, 2012, 08:39:35 AM
Because you are using the START command without the WAIT option.  But even then some programs don't obey the wait option.  So just execute the first command without the START command.

c:\path\tdpexcc.exe
Tail.exe -20 logfile.log