cuberob Posted February 23, 2006 Share Posted February 23, 2006 Hi,I have a small question, im wondering if i can in stead of using the /wait command use some pause for xxx seconds command because the /wait command aint working (it keeps on waiting... ).example (that doesnt work)ECHO.ECHO Installing app.exestart /wait %systemdrive%\app.exeECHO yes a popup appeared i'll close itTASKKILL /F /IM app.exeThis doesnt work because because of the /wait command it never goes to the next stepexample how i want is (with xxx i just give it more than enough time to finish installing)ECHO.ECHO Installing app.exestart "/wait for xxx seconds" %systemdrive%\app.exeECHO yes a popup appeared i'll close itTASKKILL /F /IM app.exeso in this case the taskkill will kill the popup and it goes on installing.Hope it exists! as for now ill keep on googling, (wasnt able to find anything yet)... Link to comment Share on other sites More sharing options...
jaclaz Posted February 23, 2006 Share Posted February 23, 2006 As you might know there is no such command in batch files, the equivalent of UNIX "sleep" but there are two solutions:1) use an external app:DOS/Win9x/MEhttp://short.stop.home.att.net/freesoft/batch2.htmNT/2k/XPDoze v1.0http://sac-ftp.externet.hu/utiltask3.html(+many more)2) use a workaround:(please note that it is different if the environment is DOS/Windows 9x/ME or NT/2k/XP)http://www.robvanderwoude.com/wait.htmljaclaz Link to comment Share on other sites More sharing options...
cuberob Posted February 23, 2006 Author Share Posted February 23, 2006 Thanks a lot! that should work (im currently trying the Doze method, seems to work but now the taskkill wont work...) Link to comment Share on other sites More sharing options...
nmX.Memnoch Posted February 23, 2006 Share Posted February 23, 2006 (edited) Look for SLEEP.EXE...it'll do what you want. I think there's a copy in one of the Resource Kits.ECHO.ECHO Installing app.exe%systemdrive%\app.exeSLEEP xxECHO yes a popup appeared i'll close itTASKKILL /F /IM app.exeJust be sure to either include SLEEP.EXE in the same directory as your BAT/CMD or copy it to %SYSTEMROOT%. Edited February 23, 2006 by nmX.Memnoch Link to comment Share on other sites More sharing options...
Yzöwl Posted February 23, 2006 Share Posted February 23, 2006 The following example works fine for me using the just the ping command without any 3rd party tools@ECHO OFFECHO/ECHO/ Running notepad.exe minimized for five secondsSTART "" /MIN NOTEPAD.EXE &&( ECHO/ YES the application started so i'll close it PING -n 6 127.0.0.1>NUL &&( TASKKILL /F /IM NOTEPAD.EXE >NUL )) Link to comment Share on other sites More sharing options...
varakiro Posted February 24, 2006 Share Posted February 24, 2006 For 10 secs delay usePING 1.1.1.1 -n 1 -w 10000 >NUL-----------------------------------------------------------------------------------------------------------------------------For 60 secs delay usePING 1.1.1.1 -n 1 -w 60000 >NULRegards. Link to comment Share on other sites More sharing options...
gunsmokingman Posted February 24, 2006 Share Posted February 24, 2006 Or you can use VBS scriptThis has a message box that is counting down, the taskkill is hidden so there is no Cmd WindowConst Hide = 0, Norm = 1, Min = 2, Max =3 : Dim Act, Cmd1, Cmd2, CT : CT = 6 Set Act = CreateObject("Wscript.Shell") '''' OBJECT FOR THE SCRIPT Cmd1 = "Notepad.exe" Cmd2 = "%Comspec% /c Taskkill.exe /F /IM Notepad.exe" Act.Run(Cmd1),Min,False Do CT = CT - 1 Act.Popup CT ,1,"Count Down", 0 + 48 Loop Until CT = 0 Act.Run(Cmd2),Hide,TrueThis Sleeps for 6 seconds and no message box popup, taskkill is hiddenConst Hide = 0, Norm = 1, Min = 2, Max =3 : Dim Act, Cmd1, Cmd2, CT : CT = 6 Set Act = CreateObject("Wscript.Shell") '''' OBJECT FOR THE SCRIPT Cmd1 = "Notepad.exe" Cmd2 = "%Comspec% /c Taskkill.exe /F /IM Notepad.exe" Act.Run(Cmd1),Min,False : WScript.Sleep 6000 : Act.Run(Cmd2),Hide,True Link to comment Share on other sites More sharing options...
WotC Posted February 24, 2006 Share Posted February 24, 2006 get NIRCMD - its free, small and has some other nice options... (like opening the cdrom drive, setting volume levels, remove the clock from the system tray, remove the start button :-)) Link to comment Share on other sites More sharing options...
Yzöwl Posted February 24, 2006 Share Posted February 24, 2006 Going back to my original reply, and sticking with a literal pause, where you need to press a key to close the application, the following should work as expected@ECHO OFFECHO/ECHO/ Running notepad.exe minimized with a pauseSTART "" /MIN NOTEPAD.EXE &&( ECHO/ ECHO/ The application started you may now close it ECHO/ ECHO/ Press any key to close the application PAUSE>NUL &&( TASKKILL /F /IM NOTEPAD.EXE >NUL )) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now