Link Search Menu Expand Document

Windows Command Line Cheat Sheet

Various windows commands are really helpful. We can execute them using Command Prompt. Basically, almost every process that you can do using the UI of windows, you can do that by entering some specific commands on CMD.

However, most of us are not aware of these commands and their usefulness. That is why we have compiled all the Windows Commands on this cheat sheet.

  1. If you want to see the list of processes currently running, write tasklist on the command line and press Enter.
  2. If you want to see the processes and all the DLL files they have loaded, enter tasklist /m on the command line and press Enter.
  3. If you want to see which processes have loaded a specific DLL file, type tasklist /m [dllname] and press Enter.
  4. To see which processes are running and which services have been hosted by them, type tasklist /svc.
  5. To ask for the brief statuses of all services, type sc query.
  6. If you want to query the configuration of a specific device, type: sc qc [ServiceName].
  7. To add any key to the registry on your machine, you can use

reg add [\TargetIPaddr][RegDomain][Key]

command. The targetIPaddr determines the location of the system. The RegDomain is the registry domain where the key is located.

  1. To export any registry, you can use

reg export [RegDomain] [Key][FileName].

This exports all subkeys and values located in that domain to a specific location [Key] present in the file [FileName].

  1. To import any registry entries from a specific file

reg import [FileName].

  1. If you want to ask for the value of a specific key, type

reg query [\TargetIPaddr] [RegDomain] [Key] /v [ValueName].

  1. To shut down Windows immediately, press

shutdown /s /t 0

[This will shut down your Operating System but may not power down your hardware.]

  1. To restart Windows immediately, type shutdown /r /t 0.
  2. If you have a countdown running for shutting down or restarting your Windows, you can cancel them using shutdown /a.
  3. If you want to see all TCP and UDP port usage and process IDs, use netstat -nao.
  4. To check the usage of a port at a specific time interval, n, use the command

netstat -nao [n] | find [port].

  1. To dump all the detailed protocol statistics, type

netsat -s -p [tcp|udp|ip|icmp]

  1. If you want to install telnet services on Windows Vista:

pkgmgr /iu: “TelnetServer”

  1. If you want to install telnet clients in Windows Vista, type

pkgmgr /iu: “TelnetClient”

  1. If you want to find the directory structure for a file located in a specific directory, type

dir /b /s [Directory][FileName].

  1. To count the number of lines present on StandardOuy of [Command], type

[Command] | find /c /v “”.

This command count (/c) the number of lines which does not contain (/v) NULL (“”). These lines which have no contents are also considered as lines, so they need to be excluded manually.

  1. If you want to open the User Manager that includes group management, enter

lusrmgr .msc

  1. If you want to open the service control panel, type

services.msc

  1. To open the task manager, type taskmgr.exe.
  2. To open the security policy manager, type secpol .msc.
  3. To open Windows Event Viewer, type eventvwr .msc.
  4. To open the control panel, type control on the command line.
  5. If you want to turn off Windows’ built-in firewall, type

netsh firewall set opmode disable

  1. To configure the interface of Local Area Connections (LAN) using [IPaddr] [Netmask] [DefaultGW], type

netsh interface ip set address local static [IPaddr] [Netmask] [DefaultGW] 1

  1. If you want to configure the interface to use DCHP:

netsh interface ip set address local dchp.

Other useful articles:


Back to top

© , CMD Windows — All Rights Reserved - Terms of Use - Privacy Policy