Windows Stuff

Windows Commands

A few Windows CLI commands that I’ve found useful over time:

Command Purpose
CLI commands output in console window
gpupdate /force Update policies
net stats workstation \| find "since" Last boot time
net user "Name" /domain \| find /i "Password expires" Display password expiry date for Domain user account
pathping N.N.N.N like tracert
powercfg -h off Turn off hiberfile.sys, saves about 8 Gb disk space for desktops that don’t need hibernation
setx FOO bar permanently sets environment variable FOO=bar. Not set in current command console.
systeminfo \| find "Boot" Last boot time
vssadmin Shadow store (don’t remember why this one was useful…)
Command Purpose
Control Panels Opens GUI from command line
appwiz.cpl Add/Remove Programs
desk.cpl Display Properties
compmgmt.msc Computer Management
devmgmt.msc Device Manager
eventvwr Event Viewer
gpedit.msc Local Group Policy Editor
start fonts Fonts installed on system
lusrmgr Local Users and Groups admin
msconfig System Configuration: stuff like startup, boot options, services, startup programs, names of system commands
msinfo32 Displays general system information
sysdm.cpl System Properties -> Advanced tab -> Environment Variables
mklink /J <linkpath> <folderpath> Create “junction” (symbolic link) <linkpath> to real folder <folderpath>. E.g. to create a symbolic link C:\Comix to real folder C:\Users\Bob\Documents\Comix, type mklink /J C:\Comix C:\Users\Bob\Documents\Comix
mstsc /v:<computername> Remote Desktop Connection to <computername>
services.msc Services
taskschd.msc Task Scheduler
winver displays Windows version and build

How to “Run as Admin” from Windows button

  1. Hit the “Windows” button on the keyboard
  2. Type a command to run as admin, e.g. “services”
  3. Type Ctrl-Shift-Enter to run command AS ADMIN!

Useful Event Viewer IDs

Open Windows Logs: System then filter on Event IDs 6005, 6009 to find last boot time