Link to home
Start Free TrialLog in
Avatar of arunykand
arunykandFlag for United States of America

asked on

Batch file - wait time

Hi,
      I need to create a batch file that needs to have two commands in there, but it has to wait for the first command to finish before executing the second command.  I know I can probably put a sleep statement in-between the two, but I cannot be certain that my 'sleep' will always be the same.

Here are the two commands that I need in the batch file

ewfmgr c: -commitanddisable -live

Open in new window

ewfmgr c: -enable

Open in new window


Thank you!
ASKER CERTIFIED SOLUTION
Avatar of sjklein42
sjklein42
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arunykand

ASKER

Will this also ensure that the command window will stay open after it is complete?  I want the window to stay open and wait for the user to close the window.

Thanks
Here's the whole thing.

First does -commitanddisable.
Then loops until the device shows DISABLED status.
Then enables it.
Then waits for user to type any key to close the window.

ewfmgr c: -commitanddisable -live 

@:waitForDisabled
@sleep 1
@ewfmgr c: |findstr DISABLED >nul:
@if ERRORLEVEL 1 goto waitForDisabled

ewfmgr c: -enable

@pause

Open in new window

Great, thanks!