MS Windows Commandline Tips
Posted by Pontus Ullgren on Saturday, 10 January 2009
As a *nix user I'm used to the "powers of command line". Despite the rumors of being a GUI only OS MS Windows(C) you can do useful things from the command line.
== Systeminfo ==
The equivalent to *nix command such as ''uptime'', ''vmstat'', ''uname'' is one command ''systeminfo''
C:\>systeminfo systeminfo Host Name: MACHINE1 OS Name: Microsoft Windows XP Professional OS Version: 5.1.2600 Service Pack 2 Build 2600 OS Manufacturer: Microsoft Corporation OS Configuration: Standalone Workstation OS Build Type: Uniprocessor Free Registered Owner: Registered Organization: Product ID: XXXXX-OEM-XXXXXXX-XXXXX Original Install Date: 2006-05-18, 18:48:40 System Up Time: 0 Days, 0 Hours, 17 Minutes, 52 Seconds System Manufacturer: Hewlett-Packard System Model: HP Compaq nc8230 (DX442AV) System type: X86-based PC Processor(s): 1 Processor(s) Installed. [01]: x86 Family 6 Model 13 Stepping 8 GenuineIntel ~1729 Mhz BIOS Version: HP - 15090520 Windows Directory: C:\WINDOWS System Directory: C:\WINDOWS\system32 Boot Device: \Device\HarddiskVolume1 System Locale: en-us;English (United States) Input Locale: sv;Swedish Time Zone: (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna Total Physical Memory: 511 MB Available Physical Memory: 229 MB Virtual Memory: Max Size: 2\uffff048 MB Virtual Memory: Available: 2\uffff008 MB Virtual Memory: In Use: 40 MB Page File Location(s): C:\pagefile.sys Domain: WORKGROUP Logon Server: \\MACHINE1 Hotfix(s): 283 Hotfix(s) Installed. [01]: File 1 [02]: File 1 .... [229]: KB92 NetWork Card(s): 2 NIC(s) Installed. [01]: Broadcom NetXtreme Gigabit Ethernet Connection Name: Local Area Connection DHCP Enabled: No IP address(es) [01]: 10.10.10.10 [02]: 1394 Net Adapter Connection Name: 1394 Connection DHCP Enabled: Yes DHCP Server: N/A IP address(es)
== Shutdown or reboot ==
The ''shutdown'' command is also available on MS Windows. And it's almost the same arguments as well.
C:\>shutdown /? Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy] No args Display this message (same as -?) -i Display GUI interface, must be the first option -l Log off (cannot be used with -m option) -s Shutdown the computer -r Shutdown and restart the computer -a Abort a system shutdown -m \\computername Remote computer to shutdown/restart/abort -t xx Set timeout for shutdown to xx seconds -c "comment" Shutdown comment (maximum of 127 characters) -f Forces running applications to close without warning -d [u][p]:xx:yy The reason code for the shutdown u is the user code p is a planned shutdown code xx is the major reason code (positive integer less than 256) yy is the minor reason code (positive integer less than 65536)