Windows Command Reference

Windows CLI

Windows and command line go together like ice-cream and pickles, but there are actually some neat commands you can lean on to get things done. Here are some that I've discovered.

  • tasklist /svc: List all services
  • netstat -o -b: Show all processes/files with open net connections
  • netsh: Allows all kids of cool stuff. I especially like netsh firewall which can be used to examine or even configure the Windows Firewall settings.
  • getmac: Show device MAC addresses
  • pathping ''[host]'': Ping/traceroute combo
  • openfiles: Show/disconnect open file shares
  • fsutil: Show/modify disk settings (dirty flag, etc)
  • comp: diff
  • recover: Disk/file recovery
  • shutdown: no surirpises
  • wmic: Windows Management Instrumentation Command line (read lots of system settings not available elsewhere)
  • iexpress: Create a self extracting archive (turn .bat or .vbs into .exe)

Registry Hacks

  • Set HKLM\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\MaxNegativeCacheTtl to 0 to disable negative DNS caching.

Windows Recovery

Having problems? Try these commands:

  • dism /Online /Cleanup-image /Restorehealth
  • sfc /scannow