cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:windows:command:index.html



Windows Commands Cheat Sheet


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.

https://software.oreda.net/cmdlauncher/

Web Site

Command

Help

command /?

Exaple)
  systeminfo  /?
  robocopy /?
  net /?
  net user /?
  shutdown /?

System

Operation Command
shutdown shutdown /s /t 10
/s = Shutdown the computer.
/t xxx = Set the time-out period before shutdown to xxx seconds.
shutdown /r /t 10
/r = Full shutdown and restart the computer.
Displays environment variables. set ← cmd
Get-ChildItem env: ← powershell
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
Displays detailed configuration information about a computer and its operating system systeminfo
systeminfo /s test-server
systeminfo /s test-server /u testdomain.local\USERNAME
Displays a list of currently running processes tasklist
tasklist /s SERVER
tasklist /s SERVER /u TESTDOMAIN\USER01 /p P@ssw0rd
Change the character code chcp 437 ← English
chcp 932 ← Japanese
C:\>where robocopy   <- like which in Linux
C:\Windows\System32\Robocopy.exe

Software

Operation Command
Creates connections to terminal servers or other remote computers mstsc
mstsc /? ← Displays help at the command prompt.
mstsc /admin ← Connects you to a session for administering the server.
mstsc /f ← fullscreen
mstsc /w:1600 /h:1200
mstsc /v:192.168.0.10
mstsc /v:192.168.0.10 /w:1600 /h:1200
Start Explorer 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
System Properties control sysdm.cpl
Display Properties control desk.cpl
Add/Remove Programs control appwiz.cpl

Folder

Operation Command
Displays the name of the current directory. cd
chdir
Change Drive c:
d:
cd /d d:
Changes the current directory. cd Folder
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
Displays the directory structure of a path or of the disk tree
Creates a directory or subdirectory mkdir DIRECTORY
md DIRECTORY
Deletes a directory. rd DIRECTORY ← empty directory
rd Folder1\Folder2 ← Delete only Folder2
rd DIRECTORY /s ← including all files
rd DIRECTORY /s /q ← quiet mode

File

Operation Command
Displays the contents of a text file. type FILE
more FILE ← Displays one screen of output at a time.
Copies one or more files from one location to another. copy FILE FOLDER
copy /y FILE1 FILE2
← Suppresses prompting to confirm that you overwrite an existing destination file.
Deletes one or more files. del FILE
del /Q FILE
← /Q : Quiet mode, do not give a Yes/No Prompt before deleting.
del /S FILE
← /S Delete from all Subfolders (DELTREE)
del /F FILE
← /F : Ignore read-only setting and delete anyway (FORCE)
erase FILE
Renames files or directories. ren SRC DES
rename SRC DES
MIRror a directory tree robocopy SOURCE_FOLDER DESTINATION_FOLDER /mir
robocopy "C:\data" "\\192.168.0.10\C$\data" /mir
robocopy d: g: /mir
robocopy more

Network

Operation Command
Verifies IP-level connectivity to another TCP/IP computer ping HOSTNAME
ping IP_ADDRESS
ping -t HOST
← continue sending Echo Request messages to the destination until interrupted.
← To interrupt and quit ping, press CTRL+C.
Check Port connection Test-NetConnection <HOST> -Port <PORT>
Test-NetConnection 192.168.0.100 -Port 22
Displays all current TCP/IP network configuration values. ipconfig
ipconfig /all ← Display full configuration information.
Display route details netstat -rn
route print
Add a route 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
← “-p” Create a persistent route
If you want to contain rouring after reboot the system, you must add “-p” option.
Delete the route route delete 192.168.0.0 mask 255.255.0.0 ← network
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
Displays information that you can use to diagnose DNS infrastructure. nslookup
nslookup IPADDRESS DNSSERVER
nslookup HOSTNAME DNSSERVER
nslookup -type=soa HOSTNAME
nslookup -type=any HOSTNAME DNSSERVER
Flushes and resets the contents of the DNS client resolver cache. ipconfig /flushdns

MAC address

Operation Command
Returns the MAC address getmac
getmac /s srvmain
getmac /s srvmain /u maindom\hiropln /p p@ssW23
Displays entries in the ARP cache arp -a
Deletes an entry in the ARP cache with a specific IP arp -d
arp -d INETADDR

Port

Operation Command
Displays active TCP connections, ports netstat -an
← -a : Displays all active TCP connections and the TCP and UDP ports
← -n : addresses and port numbers are expressed numerically
netstat -an |Select-String 80 ← Powershell
netstat -an |find "80" ← CMD


User (net command)

Operation Command
net help
displays user account information net user
net user USERNAME ← detail
net user USERNAME /domain ← Active 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 computer. net localgroup
net session
net accounts
Display Login User and Login Time query user
Disk
Operation Command
net share
net use
#check
cmdkey /list
#add
cmdkey /add 192.168.100.10 /user:xxxxx /pass:xxxxx
#delete
cmdkey /delete:192.168.100.10


Time

Operation Command
Time Configuration w32tm /query /configuration
List Time Server w32tm /query /source
list ntp status w32tm /query /status
w32tm /query /status /verbose ← check offset
w32tm /resync
Restart Windows Time net stop w32time && net start w32time
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
Check RSoP(Resultant Set of Policy) rsop
rsop.msc
Displays the Resultant Set of Policy (RSoP) gpresult /? # Displays this help message.
gpresult /R # Displays RSoP summary data.
gpresult /V # Specifies that verbose information should be displayed.
gpresult /Z # Specifies that super-verbose information should be displayed.
gpresult /H check.html #
gpresult /USER targetusername /V
Display user infomation, Security Group net user /domain USER
net user /domain USER01
Domain Controller Diag dcdiag
Check Translation Overview repadmin /replsummary
Check Translation times repadmin /showrepl
Replication with manulal repadmin /replicate SORCE DEST DC=xx,DC=xxx
repadmin /replicate tyo-ad-01 hk-ad-01 DC=example,DC=local

dsquery

Operation Command
Display user dsquery user
dsquery user -limit 1000
dsquery user ou=Tokyo,dc=example,dc=local
dsquery user -disabled
Display Computer dsquery computer dc=example,dc=local
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

Package

Commnad Note
UnxUtils
GNU utilities for Win32
http://unxutils.sourceforge.net/
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.

https://software.oreda.net/cmdlauncher/




References




os/windows/command/index.html.txt · Last modified: 2021/11/19 by admin

Page Tools