Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call one batch file after another

Tags:

batch-file

cmd

I have a batch file that i am testing, all i want to do is the following

CALL ping.bat 

Then after that batch file has run i want to run another file:

CALL ping2.bat 

Right now i have these two lines beside each other in a batch file the first batch file will fire successfully but the second one does not . Any suggestions?

CALL ping.bat CALL ping2.bat 

Ping .bat is just:

ping 127.0.0.1     
like image 542
Wii Avatar asked Mar 30 '11 18:03

Wii


People also ask

Can a batch file call other batch files?

Used within a batch file to specify the name of another batch file (a file with the . BAT filename extension). The original batch file calls into action the CALLed batch file. When the CALLed batch file ends, control is transferred back to the original batch file.

What does %% do in batch?

Use double percent signs ( %% ) to carry out the for command within a batch file. Variables are case sensitive, and they must be represented with an alphabetical value such as %a, %b, or %c. Required. Specifies one or more files, directories, or text strings, or a range of values on which to run the command.

What is %% g'in batch file?

%%parameter : A replaceable parameter: in a batch file use %%G (on the command line %G) FOR /F processing of a command consists of reading the output from the command one line at a time and then breaking the line up into individual items of data or 'tokens'.

What does %1 mean in a batch file?

When used in a command line, script, or batch file, %1 is used to represent a variable or matched string. For example, in a Microsoft batch file, %1 can print what is entered after the batch file name.


1 Answers

Check that you don't have exit somewhere in the first batch. Some people habitually use that to jump out of a batch file which is not the proper way to exit a batch (exit /b or goto :eof is).

Another option is that you might call another batch in the first one without call.

like image 190
Joey Avatar answered Sep 28 '22 08:09

Joey