When working with Windows Command Prompt, developers often need to spawn new console windows while maintaining the original session. The naive approach of simply typing cmd
creates a child process within the same window, which isn't always desirable for parallel operations.
The proper Windows command to launch programs in new windows is start
:
start cmd /c "your_command_here"
This creates a completely separate console window that will:
- Run independently of the parent process
- Close automatically after command completion (due to /c flag)
- Maintain proper environment variable inheritance
For development scenarios, consider these practical implementations:
# Launch Python script in new window
start cmd /c "python myscript.py"
# Run multiple commands sequentially
start cmd /k "cd C:\projects & git pull & npm install"
# Persistent window for debugging
start cmd /k "echo Debug session started & node --inspect app.js"
You can control window behavior with these parameters:
# Minimized window
start /min cmd /c "long_running_task.exe"
# Maximized window
start /max cmd /k "build.bat"
# Specific window title
start "Build Console" cmd /c "msbuild solution.sln"
Developers often encounter these issues:
- Forgetting quotes around commands with spaces
- Mixing
/c
(close after) and/k
(keep open) incorrectly - Not properly escaping ampersands in command chains
This approach works consistently across:
- Windows 7 through Windows 11
- Both 32-bit and 64-bit environments
- Classic Command Prompt and Windows Terminal
When working with the Windows Command Prompt, you might need to spawn a new cmd.exe
window from an existing one. Simply typing cmd
or cmd /c
won't achieve this—it either reuses the current window or closes immediately after execution. Here's how to properly launch a detached console window.
start Command /h2>
The built-in start
command is your best option. It creates a new window by default and can execute commands within it.
start cmd /k "echo Hello from new window & pause"
Key parameters:
/k
keeps the new window open after execution- Multiple commands can be chained with
&
Here are some practical scenarios with different requirements:
Run a Python Script in New Window
start cmd /k "python myscript.py"
Execute and Immediately Close
start cmd /c "dir C:\ > output.txt"
Change Directory First
start cmd /k "cd /d D:\projects & git status"
For more control, consider these approaches:
Using PowerShell
powershell -command "Start-Process cmd -ArgumentList '/k','echo PS-launched window'"
Via Batch File
Create launch_new.cmd
:
@echo off
start "New Console" cmd /k %*
- Quoting becomes tricky with nested commands—use escape characters carefully
- Window titles may need explicit setting via
start "title"
- Environment variables might not inherit as expected
You can control window properties through registry settings or with additional tools like mode con
for size adjustment.