Saturday, May 19, 2012

Windows 7 Command-Line Tips and Tricks

Open CMD anywhere:
Go to the place in question in Windows Explorer, then press Shift + Right-Click. You will now notice that in the list of options, there will appear "Open command Windows here."

Open an Elevated Command Prompt:
Click on Start and in the search bar, type "cmd". Press on Ctrl + Shift + Enter. Click on "Yes" when User Account Control pops up. You will now notice that you are in C:\WINDOWS\system32.

Drag and Drop to Command Prompt:
From Windows Explorer, you can drag and drop files into an open Command Prompt. That will display the full pathname to the file in question. Plus, if you Enter, you can execute the file.

Copy and paste from the command line:
Right-Click and select Mark. Now, drag over the area you want to copy, hit Enter and the text is copied to the clipboard. Similarly, you can click on the icon in the title bar and choose Paste to paste the text you already have on the clipboard.

Hit F7 for command line history:
Hit F7 and you will get a complete list of commands that you executed. Use the arrow keys to highlight the command you want to run again or just hit the number key corresponding to the command that you want to execute.

Run multiple commands:
You can run multiple command by separating them with &&. Note that this doesn’t run the commands simultaneously. Instead, the command towards the left is run first and if it completes successfully then the second command will run. If the first command fails, then the second command will not run.

Ex: MKDIR C:\FOLDER && RD C:\FOLDER

Go fullscreen:
Hit Alt+Enter and now you have the entire screen to enter your commands and view the output. Sadly. this doesn’t always work.

Navigate the HDD:
To go somewhere on the HDD, type CD C:\%Where you want to go%. You can also type
CD %where you want to go INSIDE the dir%.

No comments: