How to keep cmd running after opening a .bat file

2020-02-25 07:49发布

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.

3条回答
家丑人穷心不美
2楼-- · 2020-02-25 07:50

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.

查看更多
地球回转人心会变
3楼-- · 2020-02-25 07:55

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

查看更多
我只想做你的唯一
4楼-- · 2020-02-25 07:58

end your bat file with @pause on its own line

查看更多
登录 后发表回答