0

I've recently come back to batch coding. Now, all my code is ready, but I want to add a special feature: a password protected "developer mode".

I've been thinking about cmd /c "" but this just exits the window.

I want to insert a code that terminates the current batch job, but then stays in the command prompt window so that the user can normally execute commands that may even affect the .bat file.

1
  • 1
    Read cmd /? in an open cmd window -> cmd /K and what about exit /b in your batch? See exit /? or read about batch commands in ss64.com
    – LotPings
    Mar 22, 2017 at 20:30

1 Answer 1

1

If you call your batch from another batch with start it stays up.

runfirst.bat : start mybat.bat

mybat.bat : your preexisting code here

mybat.bat will stay open and you can continue to execute commands in that window.

My exact test:

(Both files saved in C:\temp7)

runfirst.bat

cd c:\temp7
start mybat.bat

mybat.bat

ipconfig /all

The cmd windows stays open to c:/> after being ran.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.