Now that we have the new Windows Terminal, I never want to see the cmd.exe window again on my dev machine - is there any way I can make it replace it across the whole OS, just like in ConEmu and Cmder?
Update: I understand cmd.exe will never go away and I am not asking how to remove cmd.exe from Windows, what I would like to know is whether there is a way to redirect all input/output from cmd.exe to the Windows Terminal so that when I double-click a batch file or PowerShell script, it's output will open in a new tab within Windows Terminal (if I understand it right, this is also what ConEmu and Cmder do).
5 Answers
cmd.exe doesn't have a window. cmd.exe is just a console application. The window you usually see when you start cmd.exe has nothing to do with cmd.exe, because it's a console window drawn by a part of Windows kernel called conhost.exe. You can replace cmd.exe with whatever you want, it still won't change the console window. The console window is automatically allocated by the kernel whenever the system starts any console process.
Your only option is to use ConEmu, which intercepts conhost.exe and automatically hides the allocated console.
In Windows 11, you can choose the default terminal app to host the user interface for command-line applications.
- Open the settings by pressing the
windows key+i - Click on Privacy & security
- Click on For developers
- Scroll down until you see Terminal
- From the dropdown now select Windows Terminal in favour of Windows Console Host
Even if you run a command like cmd in the future, it will bring up the Windows Terminal instead.
Perhaps this helps someone in the future.
What you probably want is to replace conhost.exe, which is the host window for any console in windows systems.
To do this is really simple, just follow these instructions:
0Not without serious implications of applications that rely on the cmd.exe binary; WT is meant as a power tool for those of us that are very comfortable in the command interface and use it daily.
When it’s fully released, it will be a standard system binary though, just like PowerShell, and can be executed at will, integrated into all of the necessary system elements (e.g. Explorer, calling from search, etc.). Currently, it’s still in pre-release and is a PTA to compile if you don’t know what you’re doing.
With the following (run elevated), you can change how .bat files are started:
ftype batfile=%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe "%1 %2 %3 %4 %5 %6 %7 %8 %9" - This does not change the working path, so it's not a full replacement - if you want to access files in the same folder, you need to change to the directory containing the batch file by adding this to your batch files:
cd /d "%~dp0"
To revert:
ftype batfile="%1" %* 2