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

WindowsCommand LineCmd

Windows Problem Overview


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?

Windows Solutions


Solution 1 - Windows

I think this works:

start cmd.exe

Solution 2 - Windows

Here is the code you need:

start cmd.exe @cmd /k "Command"

Solution 3 - Windows

Simply type start in the command prompt:

start

This will open up new cmd windows.

Solution 4 - Windows

start cmd.exe 

opens a separate window

start file.cmd 

opens the batch file and executes it in another command prompt

Solution 5 - Windows

You can just type these 3 commands from command prompt:

  1. start

  2. start cmd

  3. start cmd.exe

Solution 6 - Windows

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.

Solution 7 - Windows

simple write in your bat file

@cmd

or

@cmd /k "command1&command2"

Solution 8 - Windows

If we simply use start command or start cmd.exe it opens cmd.

If you want to open the same command prompt window;

start "Command Prompt"

Solution 9 - Windows

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:

  1. create a batch file to run the daemon process (server application)

  2. 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

you might need to kill the process at the start of 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.

Solution 10 - Windows

launch_stack.bat will open 2 windows to run your alices.bat and bobs.bat

start alices.bat
start bobs.bat

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMark StahlerView Question on Stackoverflow
Solution 1 - Windowse.JamesView Answer on Stackoverflow
Solution 2 - WindowsxsukaxView Answer on Stackoverflow
Solution 3 - WindowsEsterlinkofView Answer on Stackoverflow
Solution 4 - WindowsBlackMaelView Answer on Stackoverflow
Solution 5 - WindowsJagadeesh HNView Answer on Stackoverflow
Solution 6 - WindowsMichaelView Answer on Stackoverflow
Solution 7 - WindowsbajieView Answer on Stackoverflow
Solution 8 - WindowsIrfan waniView Answer on Stackoverflow
Solution 9 - WindowskiteView Answer on Stackoverflow
Solution 10 - WindowsHà Mã TímView Answer on Stackoverflow