BAT文件执行后保持CMD打开 [英] Keep CMD open after BAT file executes
本文介绍了BAT文件执行后保持CMD打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的 bat 文件:
I have a bat file like this:
ipconfig
这会将 IP 信息打印到屏幕上,但在用户读取该信息之前,CMD 会自行关闭.
That will print out the IP info to the screen, but before the user can read that info CMD closes itself.
我相信 CMD 假设脚本已经完成,所以它会关闭.
I believe that CMD assumes the script has finished, so it closes.
脚本完成后如何保持CMD打开?
How do I keep CMD open after the script is finished?
推荐答案
根据您运行命令的方式,您可以将 /k
放在 cmd
之后以保持窗口打开.
Depending on how you are running the command, you can put /k
after cmd
to keep the window open.
cmd /k my_script.bat
只需将 cmd/k
添加到批处理文件的末尾也可以.感谢 Luigi D'Amico,他在下面的评论中对此发表了评论.
Simply adding cmd /k
to the end of your batch file will work too. Credit to Luigi D'Amico who posted about this in the comments below.
这篇关于BAT文件执行后保持CMD打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文