Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Trivial Tricks - Some less known Command Prompt features

19 Sep 2014   #1
Kari

Microsoft Community Contributor Award Recipient

 
Trivial Tricks - Some less known Command Prompt features

Just for fun, here are a few Command Prompt Tips & Tricks which seem to be surprisingly unknown to great many users. Just a few ones, if you have more to add please let me know. All these tricks work on Vista or later versions of Windows in both normal and administrator Command Prompt. I will update this list of more unknown commands and features whenever you geeks let me know of your gems .

Contents
(In order of which entries have been added.)
  1. How to send text output from any command directly to clipboard
  2. Scroll Command Prompt window with arrow keys
  3. Copy & Paste in Command Prompt window
  4. Change the Command Prompt font
  5. Find your motherboard specifications
  6. List all installed updates, view them as a table in browser
  7. List all services, view them as a table in a browser
  8. List all installed hardware drivers
  9. Browse and use commands in buffer with F keys
  10. List all user profiles with their respective security identifiers (SID)

1. How to send text output from any command directly to clipboard

Let's start with a real practical one. How many of you sometimes asks OP to show for instance the output from IPCONFIG or some other command in their posts? When the output is asked we often tell the OP to send the output to a text file, then copy and paste the content of that file here, so we instruct the OP to give the command like this:

IPCONFIG >C:\Users\UserName\Desktop\MyIPConfig.txt

Now the OP needs to open the MyIPConfig.txt file, select all, copy and finally paste it in his post.

Why not simplify this? Using the Pipe character (|) we can send the output directly to clipboard, bypassing the unnecessary steps of creating a text file and selecting / copying its text. Next time, tell OP to give this command and press CTRL + V in his post, that's it:

IPCONFIG |CLIP

The Pipe + Clip (|clip) at the end of any command line sends the text output of that command directly to clipboard.


2. Scroll Command Prompt window with arrow keys

By default when pressing the up or down arrow keys, Command Prompt goes through the command buffer, commands you have previously given. If you want to scroll the Command Prompt window to see your previous commands and their output you have to use the mouse and the scrollbar.

I like to scroll with arrow keys. To do that open the Command Prompt context menu by right clicking its titlebar and select Edit > Scroll:
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h29_31.png
You will now see the word Scroll in titlebar and can scroll the window using up and down arrows:
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h31_30.png
Exit the Scroll mode by pressing ESC.


3. Copy & Paste in Command Prompt window

As you certainly know, the keyboard shortcuts CTRL + C to copy and CTRL + V to paste do not work in Command Prompt window.

To copy any text from the Command Prompt, open the context menu and select Edit > Mark:
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h36_34.png
A block cursor appears at top left corner (1) and the titlebar tells you are in Mark mode (2):
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h38_25.png
Bring the block cursor to where you want to start marking, press and hold the SHIFT key and using arrow keys go to end of the part you want to mark. Now release the SHIFT key and press Enter to copy the marked region (the text it contains) to clipboard:
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h40_26.png
You can now paste the marked and copied text normally anywhere you want to.


4. Change the Command Prompt font

Command Prompt context menu, select Properties:
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h46_37.png
Select Fonts tab, choose you font and text size:
Trivial Tricks - Some less known Command Prompt features-2014-09-19_16h47_06.png

5. Find your motherboard specifications

This one from fellow geeg Maxie: To see the manufacturer, model and serial number of your motherboard, give the following command:

wmic baseboard get product,Manufacturer,version,serialnumber

Like this, input highlighted with yellow, output green:
Trivial Tricks - Some less known Command Prompt features-2014-09-20_12h06_17.png

6. List all installed updates, view them as a table in browser

To create an HTML file containing a list (table) of all installed updates on your system, give this command:

wmic qfe list brief /format:htable > "%USERPROFILE%\Desktop\Updates.html"

This creates a file Updates.html on your desktop. The file can be opened with any browser, it lists all updates installed on your system in a table.


7. List all services on your system, view them as a table in browser

Next two (#7 & #8) are samples taken from the Seven Forums DM Log Collector, thanks for the tip John. To get a table of all services on your system, give the following command:

wmic service list full /format:htable >%USERPROFILE%\Desktop\Services.html

This creates a file Services.html on your desktop. The file can be opened with any browser, it lists all services on your system in a table.


8. List all installed hardware drivers

Sometimes it's handy to get an easy to get a list of all your installed drivers. Luckily it is quite easy using Command Prompt. Give this command to copy the list to clipboard, you can paste it from there to a post or a document:

sc query type= driver state= all |clip

If you want the list in a text file instead, replace the Pipe + CLIP switch (|clip) with path and filename:

sc query type= driver state= all > "%USERPROFILE%\Desktop\Installed_Drivers.txt"

This creates a text file Installed_Drivers.txt on your desktop.


9. Browse and use commands in buffer with F keys

These practical beauties come from fellow member A Guy:

- F1: Pastes the last executed command (character by character)
  • Example: if the last executed command was attrib, first press of F1 pastes an a, next press t, third press another t and so on, each consecutive F1 pastes one more character
- F2: Pastes the last executed command (up to the entered character). When F2 is pressed, a dialog opens to ask a character. When this character is given the last command is pasted to the first appearance of this character. An example:
  • User has sent the directory (folder) listing of E:\Users to his desktop to a file. User wants to repeat the command but this time copy the directory listing of E:\Users directly clipboard. He presses F2, a dialog opens to ask a character:

    Trivial Tricks - Some less known Command Prompt features-2014-09-21_12h55_02.png
  • As the beginning of the command is the same, user only wanting to change the target >PATH_AND_FILENAME to |CLIP, user enters the character > to paste the command up to this character. The command is now pasted up to given character:

    Trivial Tricks - Some less known Command Prompt features-2014-09-21_12h55_45.png
  • User can now enter his redirection target |CLIP and execute the command:

    Trivial Tricks - Some less known Command Prompt features-2014-09-21_12h56_11.png
- F3: Pastes the last executed command (same than pressing Up arrow once)
- F4: Deletes current prompt text up to the entered character
- F5: Pastes recently executed commands (does not cycle, same than pressing Up arrow repeatedly)
- F6: Pastes ^Z to the prompt
- F7 + F9: F7 and F9 work together:
  • F7 displays a selectable list of previously executed commands:

    Trivial Tricks - Some less known Command Prompt features-2014-09-21_13h14_31.png
  • F9 lets user then enter the number of command he wants to paste:

    Trivial Tricks - Some less known Command Prompt features-2014-09-21_13h14_57.png
- F8: Pastes recently executed commands (cycles)


10. List all user profiles with their respective security identifiers (SID)

This command lists all available user accounts with their respective security identifiers (SID):

wmic useraccount get name,sid



That's it for now, I will ad more later .

Tip   Tip
Did you know that launching any program from elevated Command Prompt, the program starts with administrative privileges?

An example: Using Notepad, if you edit any INI or other settings file which is located in C:\Windows, a protected system folder, and try to save it you get an Access Denied error message. To work around this you need to run Notepad by right clicking it and selecting Run as administrator.

If you happen to have the elevated Command Prompt already open, you can run Notepad with admin rights simply by typing Notepad and hitting Enter. As it will now be launched from elevated Command Prompt, it inherits the admin rights and you can edit & save in protected system folder.

This applies to any Windows application and program.


Kari


My System SpecsSystem Spec
19 Sep 2014   #2
ThrashZone

Win-7-Pro64bit 7-H-Prem-64bit
 
 

Pretty cool Kari,
Is it time to change your description An Angry Old Man to something else like Scary Smart
My System SpecsSystem Spec
19 Sep 2014   #3
IownAmoneyPit

Windows 7 Pro x 2/Windows 10 Home/10 Pro//Windows 10 Insider Preview ?
 
 

I learned some new tricks today kari this has the markings of a great tutorial written all over it giving Brink a "run for the money" in the tutorial dept.
My System SpecsSystem Spec
.

20 Sep 2014   #4
Kari

Microsoft Community Contributor Award Recipient

 

Thanks MoneyPit. In my opinion this is really trivial, mostly for fun, that's why I posted it here in Chillout .
My System SpecsSystem Spec
20 Sep 2014   #5
maxie

windows 7 home 64bit
 
 

Nice work Kari .. I use the one below to get Motherboard Information ..


I am certain you would know it ...



wmic baseboard get product,Manufacturer,version,serialnumber
My System SpecsSystem Spec
20 Sep 2014   #6
Kari

Microsoft Community Contributor Award Recipient

 

Quote   Quote: Originally Posted by maxie View Post
Nice work Kari .. I use the one below to get Motherboard Information ..

I am certain you would know it ...

wmic baseboard get product,Manufacturer,version,serialnumber
That's a good one! Added.

WMIC is really useful, another practical use for it is to create a list (HTML table) of installed Windows Update KB-hotfixes:

wmic qfe list brief /format:htable > "%USERPROFILE%\Desktop\Updates.html"

This creates an HTML file Updates.html on user's desktop. List can then be viewed with any browser. Added this one, too.
My System SpecsSystem Spec
20 Sep 2014   #7
IownAmoneyPit

Windows 7 Pro x 2/Windows 10 Home/10 Pro//Windows 10 Insider Preview ?
 
 

Quote   Quote: Originally Posted by Kari View Post
Thanks MoneyPit. In my opinion this is really trivial, mostly for fun, that's why I posted it here in Chillout .
This is not trivial at all kari as I see more entries have been added and with a wealth more of tricks added to make a proper tutorial this would be useful to many members and would not be lost in a couple of weeks because newer threads are posted making this gem less visible.
My System SpecsSystem Spec
20 Sep 2014   #8
Kari

Microsoft Community Contributor Award Recipient

 

I already asked admins opinion on this, if the thread should be moved. In all honesty, as there are only the News and Chillout sections where repping is not possible and for some odd reason I wanted this to be "non-reppable", I posted it here.
My System SpecsSystem Spec
20 Sep 2014   #9
whs
Microsoft MVP

Vista, Windows7, Mint Mate, Zorin, Windows 8
 
 

Learned a couple of new ones. Thanks Kari.
My System SpecsSystem Spec
20 Sep 2014   #10
Kari

Microsoft Community Contributor Award Recipient

 

You are welcome Wolfgang. My absolute favorite is the ANY_COMMAND |CLIP, to get the command output directly to clipboard:
  • dir |clip
  • ipconfig |clip
  • attrib |clip
  • ... and so on
My System SpecsSystem Spec
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar help and support threads
Thread Forum
Command Prompt command <ipconfig> not working
when I open up my command prompt and type 'ipconfig' without the ' and press enter it returns the line: 'ipconfig' is nto recognized as an internal or external command, operable program, or batch file I am trying to find out the information I need in order to set up a static IP Address for port...
Network & Sharing
How to fix MBR through command prompt?
Question: What commands could I run in the command prompt during the system recovery? I try & run say "fixmbr" but it doesn't work. Say if I want to write a new master boot record how would I do that?
General Discussion
Command Prompt
How to Open a Command Prompt in Windows 7 This will show you how to open only a non-elevated a command prompt without administrator rights instead of an elevated command prompt with administrator rights (Run as administrator) in Windows 7. Some commands will need to be used in an elevated...
Tutorials
SSH command prompt
Is there any way I can use ssh or something similar to enter command line prompts from my Mac terminal, similar to SSH but windows commands? (From mac to a windows 7 desktop)
Performance & Maintenance
command prompt
Hi all i need you help me a thing :cry: I went to use autosave all text on command prompt (CMD), how can i do or use what command prompt cade for mark it autosave when i used command prompt. Example : Color 0a
General Discussion
Run administrative command prompt from command prompt
Ok So I got myself into a unique bind here. I was trying to install some custom system files (for a theme) and I did it wrong and now I cant open explorer.exe . I dont want to goto a backup because this is a easy fix. (in my view). So I need to know how to run command prompt with administrative...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 20:17.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App