WinSupp
WinSupp

Reputation: 371

Call one batch file from another and then continue batch file 1 after batch file 2 exists

I am calling batch file (say file2.bat) from another batch file (say batch file 1).

file1.bat:

echo off
@call file2.bat
@echo abc
@echo xyz
exit

I am using command exit /b to exit from file2.bat ..

For some reason, the control is not coming back to file1.bat after file2.bat exits..

What needs to be done in order to return the control back to file1.bat so that the remaining commands @echo abc @echo xyz should execute?

Thanks

Upvotes: 4

Views: 12365

Answers (1)

Dwad
Dwad

Reputation: 185

Use either cmd /c file2.bat or use goto :EOF (Where EOF means end of file), goto :eof should work in your case

Upvotes: 8

Related Questions