# Help with creating a .bat file using "call" command



## PratikGunjal (Apr 19, 2005)

Hi Guys,

Need some Help creating a batch file.

I want to create a batch file and call another batch file from the first one. The Second batch file should open a new command prompt and run some commands and then return the controll back to the first batch file.

I did use the "call" command but that does not give the desired out put. Following is an example of the batch files and the output i get :

**********First Batch File****************

CALL Second_Batch_File.bat

CD D:\MyFolder
DIR

*************************************

**********Second Batch File***************

START

CD C:\Programm Files
DIR

*************************************

What I want is that the first batch file should call the second batch file, which will open a new command window and in that new command window execute "CD C:\Programm Files" and "DIR". After that pass the controll back to First batch file and excute the remaining commands in the first Window.

But, what happens is that after the second batch file starts a new window it passes the controll to the first window and the commands that I want to run in second window are run in the first one 

Any help is appriciated 

Thanks 

-- Pratik


----------



## blaqDeaph (Nov 22, 2005)

Can you give an example of the commands that are run in the second window? Do you mean that the "DIR" command is run in the second window? Can you try using the "start" command to create another instance of the command window.


----------



## PratikGunjal (Apr 19, 2005)

Yes the "DIR" command is an example of command run in the second batch file. I have tried using the START command to open a new window but that does not help either.


----------



## awalker0878 (Dec 17, 2005)

try in first batch file "cmd /K Second_Batch_File.bat" replaceing CALL Second_Batch_File.bat


----------

