Windows Commands Cheat Sheet [cmdref.
net
Command
Help
command /?
Exaple)
systeminfo /?
robocopy /?
net /?
net user /?
shutdown /?
System
Operation Command
shutdown /s /t 10
/s = Shutdown the computer.
/t xxx = Set the time-out period before shutdown to
shutdown
xxx seconds.
shutdown /r /t 10
/r = Full shutdown and restart the computer.
Operation Command
set ← cmd
Get-ChildItem env: ← powershell
Displays environment variables.
echo %Path% ← cmd
Get-ChildItem env:Path ← powershell
path displays the current command path. path
Sets the command path in the PATH environment variable path %PATH%;C:\test\bin
systeminfo
Displays detailed configuration information about a computer and its systeminfo /s test-server
operating system systeminfo /s test-server /u
testdomain.local\USERNAME
tasklist
tasklist /s SERVER
Displays a list of currently running processes
tasklist /s SERVER /u TESTDOMAIN\USER01 /p
P@ssw0rd
chcp 437 ← English
Change the character code
chcp 932 ← Japanese
Software
Operation Command
Operation Command
mstsc
mstsc /? ← Displays help at the command prompt.
mstsc /admin ← Connects you to a session for administering
Creates connections to terminal servers or other remote the server.
computers mstsc /f ← fullscreen
mstsc /w:1600 /h:1200
mstsc /v:192.168.0.10
mstsc /v:192.168.0.10 /w:1600 /h:1200
explorer
Start Explorer
explorer . ← start Explorer with current folder
Start Calcurator calc
Microsoft Management Console(mmc) mmc
Control panel tool Command
Operation Command
Network Conection properties administration ncpa.cpl
Internet Properties control inetcpl.cpl
Mouse Properties control main.cpl
Sound Properties control mmsys.cpl
Operation Command
System Properties control sysdm.cpl
Display Properties control desk.cpl
Add/Remove Programs control appwiz.cpl
Folder
Operation Command
cd
Displays the name of the current directory.
chdir
c:
Change Drive d:
cd /d d:
cd Folder
Changes the current directory. cd %VAGRANT_HOME% ← cmd
cd $env:VAGRANT_HOME ← powerhsell
cd ..
Changes the root directory, the top of the directory hierarchy for a drive. cd \
cd %userprofile%
Displays a list of a directory's files and subdirectories. dir
Operation Command
Displays the directory structure of a path or of the disk tree
mkdir DIRECTORY
Creates a directory or subdirectory
md DIRECTORY
rd DIRECTORY ← empty directory
rd Folder1\Folder2 ← Delete only Folder2
Deletes a directory.
rd DIRECTORY /s ← including all files
rd DIRECTORY /s /q ← quiet mode
File
Operation Command
type FILE
Displays the contents of a text file.
more FILE ← Displays one screen of output at a time.
copy FILE FOLDER
Copies one or more files from one location to copy /y FILE1 FILE2
another. ← Suppresses prompting to confirm that you overwrite an existing
destination file.
Operation Command
del FILE
del /Q FILE
← /Q : Quiet mode, do not give a Yes/No Prompt before deleting.
del /S FILE
Deletes one or more files.
← /S Delete from all Subfolders (DELTREE)
del /F FILE
← /F : Ignore read-only setting and delete anyway (FORCE)
erase FILE
ren SRC DES
Renames files or directories.
rename SRC DES
robocopy SOURCE_FOLDER DESTINATION_FOLDER /mir
robocopy "C:\data" "\\192.168.0.10\C$\data" /mir
MIRror a directory tree robocopy d: g: /mir
robocopy more
(https://cmdref.net/os/windows/command/robocopy.html)
Network
Operation Command
Operation Command
ping HOSTNAME
ping IP_ADDRESS
Verifies IP-level connectivity to another TCP/IP ping -t HOST
computer ← continue sending Echo Request messages to the destination until
interrupted.
← To interrupt and quit ping, press CTRL+C.
Test-NetConnection <HOST> -Port <PORT>
Check Port connection
Test-NetConnection 192.168.0.100 -Port 22
Displays all current TCP/IP network configuration ipconfig
values. ipconfig /all ← Display full configuration information.
netstat -rn
Display route details
route print
route add 192.168.0.0 mask 255.255.255.0 192.168.10.1 ← network
route add 192.168.0.5 mask 255.255.255.255 192.168.100.1 ← host
route add -p 192.168.0.0 mask 255.255.255.0 192.168.10.1
Add a route
← “-p” Create a persistent route
If you want to contain rouring after reboot the system, you must add “-
p” option.
route delete 192.168.0.0 mask 255.255.0.0 ← network
Delete the route
route delete 192.168.20.1 mask 255.255.255.255 ← host
Change th route route change 157.0.0.0 mask 255.0.0.0 157.55.80.5
Display hostname from IP nbtstat -a IP_ADDRESS
DNS
Operation Command
nslookup
nslookup IPADDRESS DNSSERVER
Displays information that you can use to diagnose DNS (Domain Name System) nslookup HOSTNAME DNSSERVER
infrastructure. nslookup -type=soa HOSTNAME
nslookup -type=any HOSTNAME
DNSSERVER
Flushes and resets the contents of the DNS (Domain Name System) client
ipconfig /flushdns
resolver cache.
MAC address
Operation Command
getmac
Returns the MAC address getmac /s srvmain
getmac /s srvmain /u maindom\hiropln /p p@ssW23
Displays entries in the ARP cache arp -a
arp -d
Deletes an entry in the ARP cache with a specific IP
arp -d INETADDR
Port
Operation Command
netstat -an
← -a : Displays all active TCP connections and the TCP and UDP ports
Displays active TCP connections, ports ← -n : addresses and port numbers are expressed numerically
netstat -an |Select-String 80 ← Powershell
netstat -an |find "80" ← CMD
net command
Operation Command
net help
net user
net user USERNAME ← detail
net user USERNAME /domain ← Active
displays user account information
Directory
Example)
net user mark /domain ← Active Directory
change Password net user USER01 PASSWORD
displays the name of the server and the names of local groups on the
net localgroup
computer.
Operation Command
net session
net accounts
Disk
Operation Command
net share
net use
Time
Operation Command
Time Configuration w32tm /query /configuration
List Time Server w32tm /query /source
w32tm /query /status
list ntp status
w32tm /query /status /verbose ← check offset
w32tm /resync
Restart Windows Time net stop w32time && net start w32time
Operation Command
check offset w32tm /stripchart /computer:xx.xx.xx.xx
w32tm /monitor /computers:ntp.nict.jp <- check
w32tm /config /manualpeerlist:ntp.nict.jp,0x8 /syncfromflags:manual <- 0x8 is
client mode
w32tm /config /update
w32tm /resync
net stop w32time
net start w32time
w32tm /query /status /verbose <- check offset
Check NTP Registory
>Get-ItemProperty -Path
"HKLM:\SYSTEM\CurrentControlSet\Services\w32time\Parameters"
## Enable NTP
>Set-ItemProperty -Path
"HKLM:\SYSTEM\CurrentControlSet\Services\w32time\Parameters" -Name "NtpServer"
-Value "time.cloudflare.com,0x8"
Group Policy
Operation Command
Operation Command
rsop
Check RSoP(Resultant Set of Policy)
rsop.msc
gpresult /? # Displays this help message.
gpresult /R # Displays RSoP summary data.
gpresult /V # Specifies that verbose information should be displayed.
Displays the Resultant Set of Policy (RSoP)
gpresult /Z # Specifies that super-verbose information should be displayed.
gpresult /H check.html #
gpresult /USER targetusername /V
net user /domain USER
Display user infomation, Security Group
net user /domain USER01
Domain Controller Diag dcdiag
Check Translation Overview repadmin /replsummary
Check Translation times repadmin /showrepl
repadmin /replicate SORCE DEST DC=xx,DC=xxx
Replication with manulal
repadmin /replicate tyo-ad-01 hk-ad-01 DC=example,DC=local
dsquery
Operation Command
Operation Command
dsquery user
dsquery user -limit 1000
Display user
dsquery user ou=Tokyo,dc=example,dc=local
dsquery user -disabled
dsquery computer dc=example,dc=local
Display Computer
dsquery computer -name PC*
Display Group dsquery group dc=example,dc=local
Display OU dsquery ou ou=Tokyo,dc=example,dc=local
Display Domain Controller dsquery server
C:\> rundll32.exe dsquery.dll,OpenQueryWindow
Proxy settings of Office authentication and Windows Update
netsh winhttp show proxy Check the current setting status
netsh winhttp reset proxy Direct access
netsh winhttp import proxy source=ie Use the same settings as Internet Explorer
netsh winttp set proxy proxy-server=“x.x.x.x:8080”
netsh winhttp set proxy proxy-server="myProxyServer:8080" bypass-list="
<local>;*.microsoft.com;*.example.com"
Additional Commands
Commnad Note
pscp.exe http://www.chiark.greenend.org.uk/~sgtatham/putty/download.ht
(https://cmdref.net/os/windows/command/pscp.html) (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.ht
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.ht
psftp.exe
(http://www.chiark.greenend.org.uk/~sgtatham/putty/download.ht
Package
Commnad Note
UnxUtils
http://unxutils.sourceforge.net/ (http://unxutils.sourceforge.net/)
GNU utilities for Win32 find, date, grep , etc
cmdLauncher
I have developed cmdLauncher.
cmd Launcher is Input search type launcher
cmdLauncher is a useful launcher for Microsoft Windows.
You can easily access the software, file, folder you registerd.