9

win + r -> cmd -> enter

How to replace the alias of cmd?

I want to run cmder instead of default cmd.exe

13
  • add the location of the new cmd.exe to the front of your PATH variable?
    – Holloway
    Sep 11, 2014 at 21:17
  • @Trengot this don't work as long as it is called cmd.exe - I would have to rename it to something else
    – bablewa
    Sep 11, 2014 at 21:19
  • 2
    It should use the first matching executable it finds.
    – Holloway
    Sep 11, 2014 at 21:22
  • @Trengot well this makes sense. Unfortunately this don't work. Added my file-path to PATH as first one.
    – bablewa
    Sep 11, 2014 at 21:24
  • PATH=cmderpath:normalpath and also create a copy of cmder as cmd.exe on the same path as cmder
    – NuTTyX
    Sep 11, 2014 at 21:28

2 Answers 2

12

Windows uses the registry entry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths to register full paths of applications which are visible from the Win+R shortcut. We can use the same behavior by creating an entry for cmd.exe here.

Use the portable program AppPaths to safely write/edit the entry for cmd.exe to reflect the full path to cmder.exe and save. No reboot is required. You could manually write to the registry as well, but the app tests for errors before saving. Note that you will need admin rights either way.

EDIT For posterity, here are the steps for manually editing the registry as well. Note that in the following, the alias cmd == cmder will be set for all users of the PC. If you only want the mapping for your user account, replace the registry path HKEY_LOCAL_MACHINE with HKEY_CURRENT_USER in the following.

  1. Run regedit and go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths. You might need admin rights.

  2. Create a new key with the name cmd.exe i.e. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\cmd.exe

  3. Modify the Default string in the newly created key to reflect the path to cmder.exe e.g. C:\tools\cmder\cmder.exe

  4. In the cmd.exe key folder, create a new string called 'Path' and give it the value of the folder where cmder.exe is located. For the example path in step 3, this would be C:\tools\cmder. This step is not mandatory. It adds the directory to the PATH variable the cmder.exe inherits. This is useful if the directory contains any helper executables required by cmder.exe.

2
  • Well the app is crashing when I try to resize a column. Won't Investigate any more effort into this ;) But editing the registry works pretty good. This is actually a cool feature. Thank you very much! :) btw: you could edit your answer and explain how to add the registry entry (which key, where to put the .exe), for people who are reading this later..
    – bablewa
    Sep 12, 2014 at 17:42
  • Thank you, very helpful. One small detail to note: be sure to remember ".exe" at the end of your alias. Tried setting up an alias called "np" for Notepad++, but it didn't work until I made the alias np.exe. Apr 19, 2016 at 21:06
0

How I've achieved the same bypass of Windows' native applications:
1. Create a directory in root called "shortcuts" (C:\shortcuts assuming your root drive is C)
2. Add the path to the new directory to your PATH environment variable
3. Create a shortcut to cmder.exe, and rename the .lnk shortcut file to "cmd"
4. Place the shortcut into your new shortcuts directory
5. Windows+R> cmd

You would think that editing the registry would hold more sway than this workaround, but this is literally the way that I shortcut to anything, now.

5
  • Which operating system do you use? It don't work for me.
    – bablewa
    Sep 11, 2014 at 22:04
  • This has worked for me specifically in Windows 7 Home/Ultimate, and a multitude of Windows 98/XP versions. I have not tested in Windows 8, though. Sep 11, 2014 at 22:11
  • I am pretty sure this will work only if you put the path to your shortcuts directory at the beginning of the PATH environment variable, because the directories in it are parsed one by one. It's pure speculation though.
    – Maurycy
    Sep 12, 2014 at 6:01
  • I would make the assumption that the items added to the end, then, take precedence over the items added to the beginning. Overwriting existing associations, or something. It's definitely worth trying, though. Sep 12, 2014 at 21:43
  • No the path is built upon the first seen values. You have to put it first if you want it to have precedence.
    – Mo Beigi
    Aug 3, 2019 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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