简体   繁体   English

如何在打开.bat文件脚本后保持cmd运行

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

Basically I have written a "script" in notepad and saved it as a .bat file. 基本上我在记事本中写了一个“脚本”并将其保存为.bat文件。 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 . 它确实改变了目录,但我希望在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. 我读到了pause ,但它只是等待一个键,然后关闭。

cmd /k放在脚本的最后一行。

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. cmd /k启动一个新的cmd实例, /k在命令完成后停止终止控制台窗口。

用自己的@pause结束你的bat文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM