Create a new cmd.exe window from within another cmd.exe prompt

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.

Are there command line parameters to cmd.exe that will spawn another separate prompt window?

213066 次浏览

我觉得这个可行:

start cmd.exe
start cmd.exe

打开一个单独的窗口

start file.cmd

打开批处理文件并在另一个命令提示符中执行它

在 bat 文件中进行简单的写入

@cmd

或者

@cmd /k "command1&command2"

我还尝试在 CCNET 任务结束时执行运行守护进程/服务器的批处理文件; 让 CruiseControl 产生一个独立的异步进程而不用等待进程结束的唯一方法是:

  1. 创建一个批处理文件来运行守护进程(服务器应用程序)
  2. 使用任务调度程序将批处理文件作为 CCNET 任务运行(使用 schtasks.exe)

    schtasks.exe /create /F /SC once /ST 08:50 /TN TaskName /TR "c:/path/to/batchFileName.bat"
    
    • 08:50是 HH: MM 时间格式

您可能需要在 ccnet 开始时终止该进程

PS: 使用“ start cmd.exe”选择的答案不起作用; 确实产生了一个新的命令提示符,但是 CCNET 将等待产生的 cmd 完成。

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.

@echo
TITLE example.bat
PAUSE
taskkill/IM cmd.exe

Make that into an "example.bat" file, save it, then open it and run.

Here is the code you need:

start cmd.exe @cmd /k "Command"

只需在命令提示符中键入 start:

start

这将打开新的 cmd窗口。

你只需要在命令提示符中输入以下3个命令:

  1. start

  2. start cmd

  3. start cmd.exe

如果我们只使用 start命令或 start cmd.exe命令,它会打开 cmd。

如果要打开相同的命令提示符窗口;

start "Command Prompt"

Start _ stack.bat 将打开2个窗口来运行 alices.bat 和 bobs.bat

start alices.bat
start bobs.bat

您可以在命令行中写入这个命令

cmd

上一个命令将在当前命令行 with new session中打开

或者

start