We had a discussion recently about how to set a shortcut to turn off your monitor, and I just had a look at NirCmd and noticed that you can do many other cool things using shortcuts in combination with this application that would blow your mind! So, MTE is proud to present a thrilling sequel to the recent shortcut article that will show you other commands you can jot down into a shortcut that will make your computer do things like opening your CD drive and other stuff. Just make sure you don’t fill up your desktop with too many shortcuts, as tempting as it is.
1. Open/Close Optical Drive
An optical drive is better known as a CD/DVD/BluRay player/burner. Most computers have these, and most of us sit with the button a bit further from reach than comfortable. That’s why a command to open the drive is crucial. Not only that, but we’ll also teach you how to close it. Again, remember what you learned in the shortcut creation article in order to use your chops to create a shortcut for the things I’m about to teach you!
Here’s the command:
nircmd.exe cdrom open d:
Replace “d” with the letter of any drive you want to open or close. Of course, you can’t do this with a hard drive, but every other drive that has an eject function will most likely follow this command. Now, to make “nircmd” close your drive, replace “open” with “close.” That’s all there is to it!
2. Reset System Volume to Highest
The Windows system volume value is always anywhere from 0 to 65535, the former being a muted volume and the latter being the highest possible volume. With this in mind, you can use the following command to reset the system volume to its highest:
nircmd.exe setsysvolume 65535
Use with discretion and don’t go over 65535. If you want to set to a lower number, you’re always welcome to. Perhaps you can place a shortcut for night-time volume if you’d like to be considerate to those sleeping around you, then you can place a shortcut for daytime volume. It’s a hell of a lot better than having to mess with your speakers or fiddle with the volume control in Windows!
3. Mute Volume
Nothing sucks more than having an incoming phone call and scrambling around with your mouse to mute the volume only to hear that last ring before your caller is sent to the answering machine. That’s embarrassing! So, you want a desktop shortcut that does all this? Just use the following command in the shortcut:
nircmd.exe mutesysvolume 2
If “2” doesn’t work, try replacing it with “1”. Just one double click and you’ll mute your system without any fuss.
4. Close All Windows Explorer Windows
Oh, this one’s a real time saver, especially when you have a ton of these open while you’re doing some backup work or maintaining a server. It’s tough to be a programmer or writer, and even tougher to have to mess with a ton of open Windows Explorer windows you’re not even using. Here’s a command that will make all your nightmares go away:
nircmd.exe win close class "CabinetWClass"
That will help eliminate all the stress of having to close each individual window. It’s especially useful in XP, but Windows 7 users still get their fair share of gray hairs when it comes to this.
5. Save Screenshot to File
It’s kind of tiring to have to press “PrtSc” or “Print Screen” or whatever your keyboard calls it and then have to open MSPaint to paste the file, edit it, and save it. I personally hate this with a passion, so here’s a command that will save that screenshot on file:
nircmd.exe savescreenshot "c:\path\to\screenshot\sc.png"
Don’t forget the quotation marks around the path. Replace the path between the quotation marks with anything you’d like. It works a lot like the “>” directive in your command line.
Other Cool Ideas For Everyone!
Idea #1: If you have proprietary key mapping software that came with your keyboard, you can map some of your keys with the shortcut string of any of these commands. That way, when you press a particular “speed dial” key on your keyboard, the software will output the binded command and perform the action. This way, you can open your optical drive with the push of a button rather than a double-click to a shortcut!
Idea #2: If you have Windows 7/8, pin these shortcuts to your desktop and make some cool icons for them. This way, you don’t have to be at your desktop to reach any of your shortcuts. That comes useful especially with the command used to save a screenshot to file. You don’t want an ugly command line showing up in your screenshot, nor do you want to take a screenshot only of your desktop!
Before We Part Ways
If you’re a developer and you make an application that interacts with the computer in other cool ways, or you make a program that interacts with NirCmd directly, let us know through the contact form, tell us that you read this article, and you’d like a Windows expert to promote your application for you! We might make a post about it!
We hope that you have learned something new from this and can apply it to something useful. The volume controls particularly show consideration for others. Your spouse/child/parents might be asleep and it’d be really nice for you to set the volume nice and low if you don’t use headphones. Don’t forget to copy NirCmd to your “C:\Windows” directory and put “%windir%\” before “nircmd.exe” on shortcuts. There’s a button on the application for that when you open it. We’d like to hear more from all of you about what uses you’ve come up with for NirCmd and how it’s helped you. Please leave a comment and tell you how your day got easier with these new shortcuts.
Our latest tutorials delivered straight to your inbox