I am currently operating a master batch file from the main directory, and this file calls a second batch file located in a subdirectory of the main directory. Once the second batch file finishes running, I want to stay in the main directory:

@echo off 
set root_dir=C:\Users\milan\Desktop 

cd "%root_dir%\2nd_dir"
call 2nd_batch.bat

echo %cd%

I attempted to display the path of the main directory with the last “echo” command.

cd "\%root_dir%\2nd_dir\"

However, the command was unsuccessful in producing the desired result.

Askify Moderator Edited question April 30, 2023