21

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

9
  • 1
    Check out this github.com/microsoft/terminal/issues/1060 Aug 9, 2019 at 11:40
  • 6
    Can someone explain the downvotes? I read all of this superuser.com/help/asking but still can't figure out what I might have done wrong.
    – bitbonk
    Aug 9, 2019 at 11:43
  • 2
    Not sure,people should have left atleast a comment. Aug 9, 2019 at 11:44
  • I think your question is also vague,cmd will never go.What do you meant by replace Aug 9, 2019 at 11:45
  • 2
    ConEmu/Cmder is a usability nightmare and a general PITA. I would be more than happy to get rid of it once and for all, hence this question.
    – bitbonk
    Apr 20, 2020 at 13:25

5 Answers 5

3

In Windows 11, you can choose the default terminal app to host the user interface for command-line applications.

  1. Open the settings by pressing the windows key + i
  2. Click on Privacy & security
  3. Click on For developers
  4. Scroll down until you see Terminal
  5. 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.

2

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.

1

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:

https://github.com/microsoft/terminal/issues/1817

0
0

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

-1

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" %*

Screenshot of wt.exe help

2
  • 3
    "%1 %2 %3 %4 %5 %6 %7 %8 %9" will fail if there are more than 9 parameters, or the parameters have spaces. Use %* instead
    – phuclv
    Apr 20, 2020 at 13:58
  • @phuclv with %* it did not work at all for me
    – Furty
    Apr 20, 2020 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.