How to keep cmd running after opening a .bat file script

42,727

Solution 1

Put cmd /k on the very last line of the script.

Solution 2

Try the following:

@echo off
Cmd /k

cmd /k starts a new cmd instance, /k stops terminating the console window after the commands are finished.

Solution 3

end your bat file with @pause on its own line

Share:
42,727
iDon'tKnow
Author by

iDon'tKnow

Updated on July 05, 2022

Comments

  • iDon'tKnow
    iDon'tKnow almost 2 years

    Basically I have written a "script" in notepad and saved it as a .bat file. All it does is to change directory. Written like this:

    cd C:\Users\Hello\Documents\Stuff 
    

    It does change the directory, but i want to write more after that, within the cmd. Ex. choose a program to run. It seems simple, but i can't figure it out. I read about pause, but it just waits for a key and then closes down.