Saturday, April 21, 2007

Command Prompt window tips

Tip#1 - Entering a path+file into a command line

I find myself occasionally pining for the old MS-DOS days of typing everything from a command prompt. Then I have to type in a command with a long path and file embedded and I snap back to the present time. Here's a tip I paid for - actually I got it during a call I'd put in to Microsoft's PSS (Exchange) and this was something I was directed to do by the PSS Engineer.

1. Open a command prompt window (CPW)
2. Open Windows Explorer and drill down to a subfolder (say in My Documents)
3. Position the two windows so that when Explorer has focus, you can see at least part of the CPW
4. Click on the desired file and drag it to the CPW

Look at the CPW. You'll see the entire path+file, and if there are any embedded spaces, the entire thing is surrounded by double-quote marks! The entry gets inserted at the cursor location, so you can even place it in the middle of a typed command.

Tip#2 - Command history

If you're like me, you occasionally run into a situation where you have to repeat commands, not always in the same order. There's always the up-arrow and down-arrow to scroll through the previous commands, but there's got to be a better way right? Especially if you need to repeat a command you typed ten lines ago, then have to redo the one you just did.

Did you know that from earlier days of MS-DOS, there was a history buffer? I didn't until I was in another PSS call. With the focus on a Command Prompt window, the F7 key displays your history, and all commands are accessible by scrolling up and down with the arrow keys. Pressing Enter on any of them repeats the command.

No comments: