windows 从另一个 cmd.exe 提示符中创建一个新的 cmd.exe 窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/303838/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create a new cmd.exe window from within another cmd.exe prompt
提问by Mark Stahler
I am in the process of setting up CruiseControl.NET. The problem I am having is that I am running CC as a console application and when my build completes successfully and executes (using exec) it launches it within the CruiseControl DOS prompt. I am just using simple batch files to launch my app but having it run within the same prompt as CC is causing CC to think the build continues as long as my app runs.
我正在设置 CruiseControl.NET。我遇到的问题是我将 CC 作为控制台应用程序运行,当我的构建成功完成并执行(使用 exec)时,它会在 CruiseControl DOS 提示符下启动它。我只是使用简单的批处理文件来启动我的应用程序,但让它在与 CC 相同的提示下运行会导致 CC 认为只要我的应用程序运行,构建就会继续。
Are there command line parameters to cmd.exe
that will spawn another separate prompt window?
是否有命令行参数cmd.exe
会产生另一个单独的提示窗口?
回答by e.James
I think this works:
我认为这有效:
start cmd.exe
回答by xsukax
Here is the code you need:
这是您需要的代码:
start cmd.exe @cmd /k "Command"
回答by Esterlinkof
Simply type start
in the command prompt:
只需start
在命令提示符中键入:
start
This will open up new cmd
windows.
这将打开新cmd
窗口。
回答by BlackMael
start cmd.exe
opens a separate window
打开一个单独的窗口
start file.cmd
opens the batch file and executes it in another command prompt
打开批处理文件并在另一个命令提示符下执行它
回答by Jagadeesh HN
You can just type these 3 commands from command prompt:
您只需从命令提示符键入以下 3 个命令:
start
start cmd
start cmd.exe
start
start cmd
start cmd.exe
回答by Michael
START "notepad.exe"
echo Will launch the notepad.exe application
PAUSE
To make any cmd file type, all you have to do is save the contents as .bat, i.e.
要制作任何类型的 cmd 文件,您所要做的就是将内容另存为 .bat,即
@echo
TITLE example.bat
PAUSE
taskkill/IM cmd.exe
Make that into an "example.bat" file, save it, then open it and run.
把它变成一个“example.bat”文件,保存它,然后打开它并运行。
回答by bajie
simple write in your bat file
简单地写入你的 bat 文件
@cmd
or
或者
@cmd /k "command1&command2"
回答by kite
I also tried executing batch file that run daemon process/server at the end of CCNET task; The only way to make CruiseControl spawn an independent asynchronous process WITHOUT waiting for the end of process is:
我还尝试在 CCNET 任务结束时执行运行守护进程/服务器的批处理文件;让 CruiseControl 生成一个独立的异步进程而不等待进程结束的唯一方法是:
- create a batch file to run the daemon process (server application)
use task scheduler to run the batch file as CCNET task (using schtasks.exe)
schtasks.exe /create /F /SC once /ST 08:50 /TN TaskName /TR "c:/path/to/batchFileName.bat"
- 08:50 is the HH:MM time format
- 创建一个批处理文件来运行守护进程(服务器应用程序)
使用任务调度程序将批处理文件作为 CCNET 任务运行(使用 schtasks.exe)
schtasks.exe /create /F /SC once /ST 08:50 /TN TaskName /TR "c:/path/to/batchFileName.bat"
- 08:50 是 HH:MM 时间格式
you might need to kill the process at the start of ccnet
您可能需要在 ccnet 开始时终止该进程
PS: the selected answer using "start cmd.exe" does not work; a new command prompt is indeed spawned, but CCNET will wait for the spawned cmd to finish.
PS:使用“start cmd.exe”选择的答案不起作用;确实生成了一个新的命令提示符,但 CCNET 将等待生成的 cmd 完成。