Would it be possible to replace CMD with something else? Would it be possible to replace CMD with something else? shell shell

Would it be possible to replace CMD with something else?


"That same little black window" is a feature of Windows's "console" subsystem. Console-mode apps get that window pretty much for free, and have it opened for them (either by Windows itself or by the runtime libs, i forget which) when they're started from Windows rather than from the command line. (Console-mode programs run from an existing console tend to borrow the console of the parent process.)

The fact that console apps look alike doesn't necessarily mean they're all run from cmd.exe (although there's often a batch file that starts them, they can be started on their own), but that they all use the same subsystem and the same features.

With all that said, it's quite possible to write a replacement for cmd.exe. It's just a console app. The catch is making it compatible enough to run batch files (lest existing apps break when they expect to use cmd.exe), and still having enough flexibility to add whatever you want to add to a shell.


This might help you lead on alternative command shells that can be used on windows :)CMD.EXE is just a program that provide CLI interface. There are in fact good alternatives.


you could write an application that allows you to create and execute batch (.bat) files.

for example, let's say you use C# as your language. you can open a text stream to create the (.bat) files. then, you can execute them like this:

ProcessStartInfo CmdReplacement = new System.Diagnostics.ProcessStartInfo();//choose a name and then arguments that you want to send to the command promptCmdReplacement.FileName = @"C:\testfile.bat";CmdReplacement.Arguments = "1 2 3 4";//if you use this property it will prevent a console window from popping uppi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;//create new process and set starting informationSystem.Diagnostics.Process p = new System.Diagnostics.Process();p.StartInfo = CmdReplacement;//set this to tell you when the process has completedp.EnableRaisingEvents = true;p.Start();//wait until the process has completedwhile(!p.HasExited){System.Threading.Thread.Sleep(1000);}//check to see what the exit code wasif(p.ExitCode != 0){//some error occurred}