View Full Version : Quick .bat file questions...
Mr. $T$
05-16-03, 08:55 PM
I know If I type "Pause" in a .bat file it will wait till I hit any key, is there a way for me to type a commant that sets a delay for a few seconds,
and how do you run a .bat file from another .bat file that is in a different directory?
mbentley
05-16-03, 11:18 PM
Originally posted by Mr. $T$
I know If I type "Pause" in a .bat file it will wait till I hit any key, is there a way for me to type a commant that sets a delay for a few seconds,
and how do you run a .bat file from another .bat file that is in a different directory?
here is how to create a pause:
this example shows how to delay a batch file any where from 5 to 99 seconds. the example shown has a 5 second delay.
TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL
or you could use the sleep program here (http://www.computerhope.com/dutil.htm#01)
i am pretty sure that these will work if you use any os later than winme or any nt based os because choice.com does not exist in those versions...
the running of a batch file from another is easy. you just change the directory to the other batch file.
example:
@echo off
cls
echo.
echo A. Windows
echo B. Utilities
echo C. Exit
choice /n /c:ABC Pick an Option:
if errorlevel 1 goto A
if errorlevel 2 goto B
if errorlevel 3 goto C
:A
c:
cd\windows
win.com
goto end
:B
c:
cd\utilities
utilities.bat
goto end
:C
goto end
:end
in this example, :B runs a batch file from within a batch file... here is a great website of info about batch files:
http://www.computerhope.com/batch.htm
Mr. $T$
05-16-03, 11:24 PM
wow....
Hmm alot for a DOS n00b, thanks alot.
mbentley
05-16-03, 11:28 PM
Originally posted by Mr. $T$
wow....
Hmm alot for a DOS n00b, thanks alot.
if you want me to explain in some detail about anything, it'd be no problem :) that website has so much info about batch files, especially for those who are just starting out... i still go there time to time to refresh my memory about some stuff :)
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.