Computing.Net > Forums > Windows NT > How to run a Batch file in a Batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How to run a Batch file in a Batch file

Reply to Message Icon

Name: Paul
Date: March 30, 2001 at 13:52:22 Pacific
Comment:

I'm not finding how you can run a batch file from within a batch file. Can this be done? And if you can could someone please show me the syntax? Thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: vivah8t
Date: March 30, 2001 at 14:27:08 Pacific
Reply:

You can definately do this. All you need to do is put in the name of the batchfile to run. If this is for a login script or something that will run accross the network you must make sure to include the path to the batchfile. You must also be sure that the clients running the script have access to the resource that is hosting the batchfiles. So, if your batch files are test1.bat and test2.bat it would look something like this...

net use \\generic\example
test2 <-------with test2.bat being in the same directory as test1.bat otherwise...

net use \\generic\example
c:\scripts\test2.bat
or
\\generic\example\test2.bat


Hope that helps...


0

Response Number 2
Name: Paul
Date: March 30, 2001 at 17:15:41 Pacific
Reply:

Thanks, Viva! I tried it an it worked. I was just a little confused. Is there a way to place a time element on the second batch file you run so it won't execute for a certain length of time after it's initiated?


0

Response Number 3
Name: tazman
Date: March 31, 2001 at 18:31:36 Pacific
Reply:

::-------------------------------------------
::Create a batch file called wait.bat
::add the following line below.
::For batch files that neeed to
::pause for a period of time.
::To use just at the following line
::in your batch file.
:: CALL WAIT 10
::-------------------------------------------

@CHOICE /T:N,%1% > NUL
---------------------------------------------
You can use the CALL COMMAND also.
After making the wait.bat file put the following into your other batch file.

CALL WAIT 10 (10 is the number of seconds)
CALL \\DOMAIN\Netlogon\test2.bat


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows NT Forum Home


Sponsored links

Ads by Google


Results for: How to run a Batch file in a Batch file

Running a batch file on Server from Clie www.computing.net/answers/windows-nt/running-a-batch-file-on-server-from-clie/14965.html

How to run a .exe on a Remote PC vi www.computing.net/answers/windows-nt/how-to-run-a-exe-on-a-remote-pc-vi/19401.html

how to map a file! www.computing.net/answers/windows-nt/how-to-map-a-file/15183.html