Suppose I (or any running process) wanted to launch a shell in Windows (7) and issue a command, there are a number of options available. For example, one could:
- Bring up the start menu, type
cmd, and hit Enter; - Launch the command prompt via a shortcut;
- Bring up the command prompt in a third party tool (such as Launchy), or;
- Issue some commands in Windows' Run tool (Win+R), which launches the prompt, issues the command and then returns
All of the above methods will (by default) launch cmd.exe (usually located in the Windows\System32 directory).
Recently I have started to favor alternate command line shells, such as Microsoft's very own PowerShell. However, what frustrates me most about using these tools, is that I seem to have to go out of my way to launch commands through them by default.
Is there any way that I can replace the default behaviour of running cmd.exe with another shell, such as PowerShell or Cygwin? Not only so commands that I might issue from the start menu or a launcher will run in that shell, but if other applications want to open a shell, it will open in said default shell.
To be clear, it'd be nice if there was some clean way to approach this (i.e. a registry setting or configuration option somewhere, rather than simply replacing the executable file).
31 Answer
.1. Bring up the start menu, type
cmd, and hit Enter;
Type powershell instead.
.2. Launch the command prompt via a shortcut;
Change the shortcut's target.
.3. Bring up the command prompt in a third party tool (such as Launchy), or;
IIRC, Launchy just uses shortcuts from Start Menu. Some other tools are hardcoded to run cmd.exe.
.4. Issue some commands in Windows' Run tool (Win+R), which launches the prompt, issues the command and then returns
"Run" does not open a shell, cmd or any other, unless you specifically asked for it by typing its name. It runs the given program directly (AFAIK, by using ShellExcuteEx()).
The black window is a Windows Console. It does not mean there's cmd.exe running inside; it could have any console program. (Exactly the same is with Unix terminals; they could have any program running, not necessarily a shell.)
That said, some programs might still honor the %COMSPEC% environment variable.