* Windows 2003 only
MSI
To install an MSI package:
msiexec /i package.msi
System
To display system information:
systeminfo
*To set an environmental variable (/M: system wide):
setx PHPRC "C:\php" /M
User
*To display user name:
whoami
*To display groups:
whoami /groups
Files
To examine NTFS ACLS:
cacls filename
*To take ownership of files/directories:
takeown
To list open files (seems to require Administrator privs.):
openfiles
Network
To display interface configurations:
ipconfig /all
To flush DNS client cache:
ipconfig /flushdns
To display DNS cache:
ipconfig /displaydns
To do DNS queries (type help):
nslookup
To display open ports and PIDs:
netstat -ao
To display ports and executable name:
netstat -ab
IIS
To restart IIS:
iisreset /restart
RDP
*To list RDP sessions:
query session
*To reset (delete) RDP session:
reset session {SessionName|SessionID}
Processes
To display running processes:
tasklist
To kill a process:
taskkill /pid ProcessID
Eventlog
To view event log entries:
cscript "c:\windows\system32\eventquery.vbs" /l {application|system|security|"dns server"|*}
For example, to list shutdowns:
cscript "c:\windows\system32\eventquery.vbs" /l system /fi "id eq 1074 or id eq 1076" /fi "source eq user32" /v
Shutting Down
To shutdown the computer (planned, other reason):
shutdown /s /c "Reason for shutdown." /d p:0:0
To reboot the computer:
shutdown /r /c "Reason for reboot." /d p:0:0
Links
Windows XP
- Command-line reference http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_o.mspx
- Command-line reference A-Z http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
Windows 2003
- Command-line reference http://technet2.microsoft.com/WindowsServer/en/Library/fdc12a63-df4e-49e7-94d6-177536b18eb61033.mspx
- Command-line reference A-Z http://technet2.microsoft.com/WindowsServer/en/Library/552ed70a-208d-48c4-8da8-2e27b530eac71033.mspx