批处理文件出口/B [英] batch file exit /B
问题描述
我只希望在完成如下所示的批处理文件后将cmd.exe窗口保持打开状态.我正在测试使用cmd.exe版本6.1.7601从Windows 7资源管理器启动它.发出哔声和暂停可以正常工作,但是我想让cmd打开以发出后续命令.
I simply wish to leave a cmd.exe window open upon completion of a batch file like the following. I am test launching it from Windows 7 Explorer, with cmd.exe version 6.1.7601. Beeps and pause work fine, but I want to leave the cmd open to issue subsequent commands.
@echo off
:: wschloss Jul 2015
:: This batch runs if the laptop's Core Temp is close to critical
:: as determined by the "Core Temp" utility at
:: "C:\ORION\System Information\CoreTemp\64bit\Core Temp.exe"
:: http://www.alcpu.com/CoreTemp/
::
color 1F :: White on Blue
:: Beeps!
echo .
type c:\bill\beep.txt :: causes the Laptop to beep for attention
cls
::
echo .
echo Laptop Critical Temperature Approaches!
echo .
echo Save Your Data and Cool me down NOW!
echo .
pause
color
exit /B
:: EOP
这似乎微不足道,但我显然缺少了一些东西.感谢您的帮助.
This seems trivial but I am obviously missing something. Thanks for any help.
推荐答案
在文件末尾添加cmd /k
以将程序重定向到命令提示符. (它将结束您的程序,然后在同一窗口中打开命令提示符)
Add cmd /k
to the end of your file to redirect the program to Command Prompt. (It will end your program, then, in the same window, open command prompt)
@echo off
:: wschloss Jul 2015
:: This batch runs if the laptop's Core Temp is close to critical
:: as determined by the "Core Temp" utility at
:: "C:\ORION\System Information\CoreTemp\64bit\Core Temp.exe"
:: http://www.alcpu.com/CoreTemp/
::
color 1F :: White on Blue
:: Beeps!
echo .
type c:\bill\beep.txt :: causes the Laptop to beep for attention
cls
::
echo .
echo Laptop Critical Temperature Approaches!
echo .
echo Save Your Data and Cool me down NOW!
echo .
pause
color
cmd /k
:: EOP
那样,如果您希望清除以前的输出,则可以在cmd /k
之前添加cls
.
That, and if you want the previous output cleared, you could of course add cls
right before the cmd /k
.
这篇关于批处理文件出口/B的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!