Windows 7 tricks: Copy To the Clipboard From the Windows Command Prompt

Posted on:
tags: , , ,

Let’s face it, not everybody is an ubergeek, so there are many times that you’ll need to ask somebody for help. They always seem to ask you to type things into the command prompt and then tell them the results… but how do you copy that text to the clipboard so you can email it to them?
I had always thought this was universally understood, but it turns out that a lot of people are unaware of how it works. There are two options, the default right-click menu… or QuickEdit mode. We’ll explain both.
Enable QuickEdit Mode
Right-click anywhere on the title bar and then select Properties. (Or use Alt+Space P)

On the Options tab, check the box for “QuickEdit Mode” and then close the dialog.
That was simple…
Copy / Paste in QuickEdit Mode
If you have this mode enabled, you can simply left-click anywhere in the window and drag a box around the text that you would like to select.
Once you’ve selected the text, you can either right-click anywhere in the window or use the Enter key to copy the selected text to the clipboard.
To paste into the command prompt, simply use the right mouse button anywhere inside the window while not in “Select” mode.
Copy / Paste With Right-Click Menu
If you don’t want to change any settings, you can just use the right-click menu to copy or paste text. Note that the right-click menu doesn’t show up with QuickEdit mode enabled.
Right-click on the background of the window and select “Mark”, and then draw a box around the text you want to copy.



Once you have selected the text you want, then use the right mouse button or the  Enter key to copy the selected text to the clipboard.
To paste into the window, right-click and choose the “Paste” option on the menu.







Shutdown Command Via Command Prompt

Posted on:
tags: , , ,


The 'Shutdown' Command Becomes More Flexible and Automated when used from the Command Prompt.

To Run the 'Shutdown' command from the command prompt, go to 'Start > Run', type 'cmd', and press 'Enter'.
In the black box (the command prompt) type 'Shutdown' and the Switches you want to use with the 'Shutdown' command.
You have to use at least one switch for the shutdown command to work.

The Switches :-
The 'Shutdown' command has a few options called Switches. You can always see them by typing 'shutdown -?' in the command prompt if you forget any of them.

-i: Display GUI interface, must be the first option
-l: Log off (cannot be used with -m option)
-s: Shutdown the computer
-r: Shutdown and restart the computer
-a: Abort a system shutdown
-m \\computername: Remote computer to shutdown/restart/abort
-t xx: Set timeout for shutdown to xx seconds
-c “comment”: Shutdown comment (maximum of 127 characters)
-f: Forces running applications to close without warning
-d [u][p]:xx:yy: The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536)

Note :- I’ve noticed using a switch with a '-' sign doesn’t work sometimes.
If you are having trouble try using a '/' in place of '-' in your switches.

Examples :-
shutdown –m \\computername –r –f
This command will restart the computer named computername and force any programs that might still be running to stop.

shutdown –m \\computername –r –f –c “I’m restarting your computer. Please save your work now.” –t 120
This command will restart the computer named computername, force any programs that might still be running to stop, give to user on that computer a message, and countdown 120 seconds before it restarts.

shutdown –m \\computername –a
This command will abort a previous shutdown command that is in progress.

Using A Batch File :-
You can create a file that performs the shutdown command on many computers at one time.

In this example I’m going to create a batch file that will use the shutdown command to shut down 3 computers on my home network before I go to bed.

Open 'Notepad' and type the shutdown command to shut down a computer for each computer on the network.
Make sure each shutdown command is on its own line.
An example of what should be typed in notepad is given below-

shutdown –m \\computer1 –s
shutdown –m \\computer2 –s
shutdown –m \\computer3 -s

Now I’ll save it as a batch file by going to file, save as, change save as type to all files, give the file a name ending with '.bat'. I named mine 'shutdown.bat'.
Pick the location to save the batch file in and save it.

When you run the batch file it’ll shutdown computer 1, 2, and 3 for you.

You can use any combination of shutdown commands in a batch file.
>