Run batch file as command without calling it

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
batchcc
Posts: 139
Joined: 17 Aug 2015 06:05
Contact:

Run batch file as command without calling it

#1 Post by batchcc » 24 Dec 2015 10:15

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?

Squashman
Expert
Posts: 4471
Joined: 23 Dec 2011 13:59

Re: Run batch file as command without calling it

#2 Post by Squashman » 24 Dec 2015 11:05

Because control is passed to the 2nd batch file. It will not return to the first batch file unless you use the CALL command.

Post Reply