[Lowerbounds, Upperbounds]

Algorithms are everywhere.

Even though I am a Windows user, I spend a lot of time in the command prompt. While many Unix users actually tweak their .login and related files, I’ve seen a lot of Windows users living with the default. This series proposes several easy fixes to make their life easier.

First thing first: the command prompt that all of us should be using on Windows NT or later is cmd.exe whereas command.com is there only for backward compatibility…

I recommend associating a hotkey to your command prompt. I use Ctrl-Alt-Z to mimic the Ctrl-Z feeling in Unix.

Many Windows users miss this feature. For each shortcut in your Start menu, you can associate a hotkey with it. Right click on Start->Programs->Accessories->Command Prompt. Click Properties.

Command Prompt Hotkey

Click on the text field of Shortcut key and press Ctrl-Alt-Z. Then click OK.

Now no matter where you are, pressing Ctrl-Alt-Z will get you to the command prompt.

P.S. There is an annoying “feature”. If you have opened a command prompt already, it will bring you there instead of opening a new one. I will tell you how to fix it later.

11 Comments

  1. Nice! On a related note, I’ve set up Thunderbird so that it opens up when I press a shortcut; however, if TBird is already open when I press it, it does nothing. (As expected.) However, is there some way of setting up a shortcut so that it brings up the ThunderBird window (regardless of whether it is currently running or not)?

  2. What happens when you press a shortcut key also depends on the application. I have not tried Thunderbird (I use PCPine) and I won’t be surprised if it behaves differently from other Windows apps. I will take a look at it later and see what actually happens.

  3. AvatarRodney
    19:21 on August 23rd, 2005

    I want to make a short cut on my desktop or in my quick launch bar that mimics a hot key press. I want to make a shortcut that mimics the “windowsKey+M” to minimize all windows. IS that possible?
    Thanks

  4. Rodney, it’s certainly possible (by writing a simple windows executable and then associate a shortcut to it with a hot key).

    But why would you want to press a key combination other than Windows+M if you have the Windows key? Is it because your keyboard doesn’t have a Windows key? Perhaps because you are using an IBM ThinkPad?

  5. Ctrl + Alt + Z is really a cool idea! Thanks!!

    How about that “I’ll tell you later” answer on how to launch a new CLI each time I use the hotkey?

  6. I originally had a more complicated solution, but recently I have discovered a much simpler one.

    First, create a batch file called “cmdprompt.bat” (or anything you like) and put it in, say, C:\Windows\. It contains exactly one line:
    @start “Command Prompt” “%USERPROFILE%\Start Menu\Programs\Accessories\Command Prompt.lnk”

    Then, open Explorer and locate cmdprompt.bat in your Windows directory. Right drag (hold the right button to drag) cmdprompt.bat onto your Start Menu. Drop it (release the right button) and select “Create Shortcuts Here” in the popup menu. Now you will have a new item in your Start Menu called “cmdprompt”.

    Now right click on the shortcut in your Start Menu. A similar Properties window should come up. First, click on the Run combo box and select Minimized.

    Then, assign a shortcut key to this shortcut by pressing the desired key in the Shortcut key input box. Note that you have to either pick a new key combination or erase the Ctrl-Alt-Z from the Command Prompt shortcut first, or else when you press Ctrl-Alt-Z in the new shortcut you will fire up the Command Prompt.

    Then, click on the Change Icon button and set it to %SystemRoot%\system32\cmd.exe, which only bundles with the default command prompt icon.

    Finally, (this is optional but I am pedantic), go to the Layout tab and then uncheck “Let system position window”.

    Have fun!

  7. I finally got TBird installed (for occasional usage; I am still using Pine primarily) and the “shortcut to a batch file that launchs another shortcut” trick below works. Even when TBird is minimized, it still comes up when you press the hotkey that is associated to this shortcut.

    Another level of indirection. :P

  8. AvatarAnonymous
    12:12 on October 17th, 2006

    So… If I understand this correctly, you created a batch file that starts the command prompt, and made a shortcut to the batch file.

    Didn’t work for me. It does launch the command prompt, but it has the same problem as before, it won’t launch more than one occurance. Subsequent key presses simply bring it to the foreground.

    (I used a differnet Shortcut key so there’s no conflict there.

  9. Yes, it’s a batch file that will run Command Prompt.lnk. Then, we assign the shortcut key to the batch file.

    To verify your setup, can you try manually running the batch file multiple times and see if you get multiple command prompts? If you only get one, then this method will not work.

    Once you are sure that the batch file works on your machine, remember the shortcut key should be set on (the shortcut to) the batch file. That way, each shortcut key press will run the batch file, just like the experiment above.

  10. AvatarAnon
    19:01 on October 21st, 2006

    Hi! and what about this: open a command prompt _in current folder_? You navigate to a folder with the explorer, and press a shortcut when window is in focus? It would bereally great…

  11. AvatarRf
    16:08 on January 3rd, 2007

    Uh…This has been a feature in the Windows Power Toys bundle for years (at least as far back as 2002, maybe even earlier!)
    Go here:
    http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
    and scroll down to:
    Open Command Window Here

    This little extension allows you to right-click on any folder and open a cmd window at that folder location.

    No need to program anything and it’s always there!
    Ed
    web/gadget guru