Although PowerShell has made progress over the last few years as the preferred command line tool, I find that knowledge of the original command line is still very valuable. You can use the command line to quickly get system information or write batch scripts to automate simple tasks.

Most commands can be run as a regular user. But, as always, depending on what you are doing some commands may need to be run at an elevated prompt. To see all available commands, type “help”. To see help about a specific command use “<command> /?”.

Navigate & Help

cd /d H:Change drive to H: drive
cd \Change directory to C:\
helpSee all commands.
<command> /?Get help about command <command>.

User Information

net user administrator /active:yesEnable the hidden Administrator acct (run cmd as admin).
gpupdate /forceUpdate the user’s group policies.
net user username1 /domainGet current user details (last logon, passwd age, etc).
gpresult /user <user1> /r | moreGet a list of the user’s domain groups.
psloggedon \pcname or ipSee who is logged in (sys internals).
net usersprint a list of all system users.
sc query | moreDisplay status of active services.
net localgroup administratorsList all local administrators.
net localgroup “remote desktop users”List users allowed to login remotely.

Folder & Files

dirDisplay files in the current folder.
cipher s:/<Folder name> Check if a folder/file is encrypted.
cipher /cDisplay info on the encrypted file.
mkdirMake a Directory
find or findstr “Find”Find all lines with the word “joe”.
del newfile.txtDelete the file newfile.txt.
move [source] [ target]Move file to new location.
fc /a monthly.txt sales.txtCompare two text files.
robocopy /s [src] [dst]Copy directories except empty ones.

System Information

msinfo32Launch the system info GUI.
hostnameDisplay the name of the computer.
wmic cpu get numberofcores, NumberOfLogicalProcessorsDisplay # of CPU cores and logical processors.
wmic /node:10.10.56.10 bios get name, versionDisplay BIOS name & ver. from a remote PC.
wmic os get caption, versionDisplay OS name and version.
wmic computersystem get manufacturer, modelDisplay PC manufacturer and model.
systeminfo <hostname> | find “OS Name”Display the OS Name only.
net shareList all files on the system that you are sharing.

System Tasks

msconfigLaunch sys config GUI. Manage startup programs.
taskkillKill running processes.
shutdown /rShutdown and reboot the pc.
mstsc /adminStart an RDP session.
tasklistdisplay running processes.
wmic process get description, executablepathdisplay running executables.
schtasks /query | moreDisplay scheduled tasks

Networking

ping -aTest network connectivity and resolve DNS.
ipconfig /allDisplays current IPv4, DNS server name, and Gateway router IP, and other info.
nslookupReturns an IP address or a name.
tracert <url>Trace & displays path to reach an internet host.
netstat Check the UDP/TCP connections. ( See Article)
route printList routing table.
arp -aGet address resolution table.
netshChange network setting, like whether to use DCHP (See below).
nbstat Display stats and current connections using NetBIOS over TCP/IP.

How to Manually Set Your Networking

Run these commands at an elevated prompt.

Set a static IP

Set DHCP from a static IP address

Set A Primary DNS Server To a static IP

Set the secondary DNS server to a static IP

Set your DNS settings to be assigned dynamically

netsh interface ip set dnsservers name="Local Area Connection" source=dhcp

Related Posts