Solved

Call another batch file

Posted on 2008-06-20
12
1,691 Views
Last Modified: 2008-06-20
Good day

How do I call a batch file from within another batch file? So when I run the 1st batch file it should automatically run the one I'm calling.
0
Comment
Question by:TIO-Solutions
12 Comments
 
LVL 1

Expert Comment

by:gavbell
ID: 21829099
Hi All you need to do is enter

call %logonserver%\netlogon\batchfile.bat

batchfile being the batch file that you want to run 2nd

Cheers

Make sure its in the netlogon folder also matey.
0
 

Author Comment

by:TIO-Solutions
ID: 21829114
Hi there

It is not working. How will it know where the 2nd batch file is located?
0
 
LVL 1

Expert Comment

by:gavbell
ID: 21829139
You will need to put the 2nd batch file in the \\logonserver\NETLOGON folder.
"logonserver" being your domain controller.
cheers
0
 
LVL 1

Expert Comment

by:gavbell
ID: 21829153
it you want the batch file to run from another location type

call \\server\share\batchfile.bat

Cheers

I just put them all in the netlogon folder so you dont need to tell it where it is and also if you have more than 1 domain controller it will replicate the batch files automatically so there is a copy of each one on all DC'S.
0
 

Author Comment

by:TIO-Solutions
ID: 21829165
If it's on my local machine, do I just change the location? This is what I' got:

copy c:\intranet\test.bat c:\intranet2
copy c:\intranet\test.reg c:\intranet2

now I need to run the test.bat file
0
 
LVL 1

Expert Comment

by:gavbell
ID: 21829181

copy c:\intranet\test.bat c:\intranet2
copy c:\intranet\test.reg c:\intranet2

call c:\intranet\test.bat


that should do you.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:TIO-Solutions
ID: 21829201
the problem is I want to copy the test.bat and test.reg files from a central point to some users onto their local pc's. Which means, I need to call the file I've copied and run it. By example I should call c:\intranet2\test.bat which is not working
0
 
LVL 87

Expert Comment

by:rindi
ID: 21829236
There is no mention of domains or servers in the Question. So just use the full path to the 2nd batch file after the call command, similar to the examples above.

If your 2nd batch file is file2.bat, and it is located in C:\Batch, use:

call C:\Batch\file2.bat

If the batch file is on a filesystem that supports long filenames, and it is located in C:\Batch Files, then you can try using:

call "C:\Batch Files\file2.bat"

or

call C:\BatchF~1\file2.bat

The command above is used if your DOS version can only cope with the 8.3 filenames that were supported on old filesystems. In that case you can only use 8 characters in your directory name of your batch file.
0
 

Author Comment

by:TIO-Solutions
ID: 21829326
Not working.
We dont have AD so now we need to copy a batch file that will make changes to your registry. So I want to dump the two files on the server and then copy it to the users machine through a batch file that will then also automatically run the batch file that has been copied.
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 21829727
There is no need for the copy part. Why not executing from server share directly?
0
 

Author Comment

by:TIO-Solutions
ID: 21830547
cant push it through NT
0
 

Author Comment

by:TIO-Solutions
ID: 21831017
Got it working thanks
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now