Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

  1. Bring up the start menu, type cmd, and hit Enter;
  2. Launch the command prompt via a shortcut;
  3. Bring up the command prompt in a third party tool (such as Launchy), or;
  4. 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).

share|improve this question
    
Not exactly what you asked for but better: code.google.com/p/conemu-maximus5 –  krowe Dec 5 at 23:43

1 Answer 1

up vote 5 down vote accepted

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

share|improve this answer
    
I guess my problem is with other applications primarily. For example, in Explorer, hold Shift, right click and then click Open command window here. By default, it opens cmd.exe. What is telling Windows to do that, is that the %COMSPEC environment variable? –  gpmcadam Jul 31 '10 at 22:16
    
@Bauer: That right click is set in the registry, the commands associated with file type "Folder" or "Directory" (later is filesystem folders only), or by an Explorer extension. –  Richard Aug 1 '10 at 8:36
    
@Richard: It would be Directory. ("Open command prompt" wouldn't make any sense for non-filesystem folders.) –  grawity Aug 1 '10 at 12:38
    
@Bauer: In Windows Vista and newer, it's probably hardcoded to the Explorer shell (but try changing %COMSPEC% anyway). In XP and older, it's either a command verb in Registry\HKCR\Directory\shell or an Explorer shell extension, like @Richard said. –  grawity Aug 1 '10 at 12:39
1  
@Gravity: <pedantic>PowerShell (to name one example) is not limited to file system directories: cd HLKM:\software\classes works fine. –  Richard Aug 1 '10 at 20:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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