Home > Uncategorized > More Command Line Stuff

More Command Line Stuff

Thursday, August 14, 2008 Ben Leave a comment Go to comments

As I’ve mentioned several times before, I’m not exactly “great” at using the command line (although I am getting better).  And, as I’ve also said before, we’re seeing the command line make a comeback — it seems like the rest of us are starting to catch up to the uber-Admins who have been saying for years that they can do their work easier with a command line.

Windows has a series of commands built into it that can be executed from the comamnd line (the run command too), and a big list of those can be found at this website.  These are all well and good (especially coming from a Vista standpoint, where we can build shortcuts with the RUNAS command: creating a shortcut to Control Panel for example would instead of “Control Panel”, we would type in RUNAS /USER:ADMIN “Control Panel” and then the Control Panel would open with Admin rights.  Woo hoo, yadda yadda, we’ve been through this before.

For the fine-tuning stuff, there’s a tiny app out there you can use that will do mundane things such as opening a CD-ROM door, turning down your volume , etc.  This app is called NIRCMD, and can be downloaded in a .zip file here (look at the very bottom of the page).

Once you download the file, extract all of the contents to your C:\Windows\System32 folder.  Now, via the command prompt or the run command you can do some pretty interesting stuff.

For example, if I wanted to open my CD-ROM drive, I would issue this command:

nircmd cdrom open D:

If I wanted to log off, I could issue this command:

nircmd exitwin logoff

There are all kinds of examples I could go through, but there are plenty up on NIRCMD’s web site as well as a listing off all the commands and their available options for you to build your own tasks.

Now, why am I making a big deal out of this? The main reason I’m doing this, is that since we have activities like CD-ROM drives opening and sounds getting louder and softer tied to a specific app, we can make Desktop Shortcuts that do what we want! No longer will I have to go through clicking multiple times, I can simply double click a desktop icon to do something.

Let’s assume that I want a desktop icon to double click when I want to log out. This might be a good thing to do for a user who doesn’t want to or simply doesn’t understand the concept of logging off the correct way. Having this user simply double-click an icon would be a nice time-saver for both user and IT staff. Here’s how we would set that up (assuming you’ve already extracted NIRCMD to your SYSTEM32 folder):

  1. Right-click the user’s desktop
  2. Click New > Shortcut
  3. For the path, or location of the program/file, type this in: nircmd exitwin logoff
  4. Give the shortcut a meaningful name, like “Logoff”

And that’s all there is to it!  Now, when a user double-clicks that shortcut, the NIRCMD command with the applicable options will be launched, and the user will get logged off!

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.