Page 1 of 1

Return to the 1st batch file

Posted: 06 Jun 2021 18:36
by falcios
1st batch file contains the call command

call "d:\sfd\dtsc\admt\bat\net use.bat"

Few lines from the 2nd batch file

:MENU
Echo Press 0 for Test
Echo Press 1 for Test1
Echo Press 2 for Test2
Echo Press 3 for Test3
Echo Press 4 for Test4
Echo Press 5 for EOF
Echo Press 6 for Exit
set /p input=Enter 1-6:

if %input% == 0 goto :Test
if %input% == 1 goto :Test1
if %input% == 2 goto :Test2
if %input% == 3 goto :Test3
if %input% == 4 goto :Test4
if %input% == 5 goto :EOF
if %input% == 6 goto :EXIT
:EOF
EOF
:EXIT
Exit /b

When I select :EOF it exits the 2nd batch file. Exit does also.

What command do I use in the second batch file to return to the 1st batch file?

Thanks in advance.

Re: Return to the 1st batch file

Posted: 06 Jun 2021 18:47
by ShadowThief
A script run via call will return control to the script that called it once the second script is over.

That said, there's already a command called net use, so that may be causing issues. Never name a script the same thing as a command that already exists.

Re: Return to the 1st batch file

Posted: 06 Jun 2021 19:36
by falcios
Per your suggestion, I changed the second batch file to drivesmap.bat and it still doesn't return to the 1st script.

Any idea how to fix this?

Thanks

Re: Return to the 1st batch file

Posted: 06 Jun 2021 19:46
by ShadowThief
No, because it should be doing that automatically. Post your entire scripts and we'll be able to troubleshoot more effectively.

Re: Return to the 1st batch file

Posted: 06 Jun 2021 19:56
by falcios
Thank you so much it worked.
As you suggested I have added a second call batch file in the original.