Windows Command Prompt Tricks

Tips-And-Tricks

Enter multiple commands at once
Adding && between commands will let you enter multiple lines at once to be executed in succession. e.g,
tasklist && netstat -b

List every device driver on your PC
The following command line displays the list of device drivers on your PC
driverquery /FO list /v

Output results to text file or clipboard
You can save the output of a command to a new text file by adding “>” along with a directory and file name. e.g,

driverquery > C:\Users\TechSpot\Desktop\output.txt

Delete temporary files from your drive

Some of the temporary files on your computer can be deleted with the commands as below
(/q runs the command without a confirmation prompt, /f ignores the read-only attribute and forces deletion, /s deletes contents from all sub-folders):

To delete temporary user files: del /q /f /s %temp%\*
To delete temporary system files (it requires administrator rights): del /s /q C:\Windows\temp\* 

Open Windows’ on-screen keyboard
If you enter “osk” into a Command Prompt it will open Windows’ on-screen keyboard which lets you click keys with your mouse instead of typing them.

Create a Wi-Fi hotspot & Find your Wi-Fi password
If your network card supports the feature, you can configure your computer to be a wireless hotspot from the Command Prompt.

To check if your hardware is capable to become hotspot: Enter “netsh wlan show drivers” and look for the line that reads “Hosted network support: Yes.”

From there, you can enable the hotspot with this command: netsh wlan set hostednetwork mode=allow ssid=YOURSSID key=YOURPASSWORD

Also enter this line to enable the hotspot: netsh wlan start hostednetwork and you can check the status of your new hotspot by entering netsh wlan show hostednetwork.

Encrypt And Decrypt Files

Files and folders can be encrypted and then unencrypted with individual commands:

Encrypt a file or folder: cipher /e C:\MyFolder

Decrypt that file or folder: cipher /d C:\MyFolder

Get Command History

You can track down your command history you have recently used using command prompt:

doskey /history

Rout the output of your command to clipboard
You can pipe/route your command output to the system’s clipboard, e.g the following command outputs the ip configuration information to the clipboard.

ipconfig | clip

Use flushdns switch to Speed up internet

Your computer maintains a list of the websites and their corresponding IP addresses that you access the most in the DNS resolver cache. This makes rendering those websites very quick when you access them the next time because it serves them right from it cache. Sometime this data becomes obsolete or you may no longer need a large resolver cache with too many websites from the past. So when you flush the DNS resolver cache, you actually flush out the obsolete data as well.

ipconfig/flushdns

Show current Wifi connection information including password

netsh wlan show profile key=clear

Among other things it will show the connection password against “Key content” under Security settings.

Working with Services

To show services window:
services.msc

To manually stop and start a windows’ service:

net stop
net start

To stop a service (ServiceName2) from a remote machine:

sc \ip.ip.ip.ip stop ServiceName2

Leave a Reply

Your email address will not be published. Required fields are marked *