Page 1 of 1

Run batch file as command without calling it

Posted: 24 Dec 2015 10:15
by batchcc
Can I run batch file as command without calling it for example

File1.bat

Code: Select all

@echo off 
Cls
Hello
Pause

In this code hello would be a command that calls a file in the same directory named hello.bat here is hello.bat's code

Code: Select all

@echo off 
Cls
Echo hello

When I try to do this the code exits rather that pausing why and how can I fix this?

Re: Run batch file as command without calling it

Posted: 24 Dec 2015 11:05
by Squashman
Because control is passed to the 2nd batch file. It will not return to the first batch file unless you use the CALL command.