Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The aim for this Wiki is to promote using a command to open up commonly used applications without having to go through many mouse clicks - thus saving time on monitoring and troubleshooting Windows machines.

Answer entries need to specify

  • Application name
  • Commands
  • Screenshot (Optional)

Shortcut to commands

share

locked by Zypher Dec 11 '11 at 21:18

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

11  
If you find this stuff interesting, take a look at commandlinefu: commandlinefu.com It's basically like digg for CLI –  username May 11 '09 at 6:47
1  
Try putting each command as a separate answer. Then we can vote and comment on each one. –  lamcro Jun 26 '09 at 12:22
1  
This is a great question, super useful info, and the stackexchange engine made it trivial to find. I agree with @lamcro, however, that structuring each command as an individual answer would likely provide more value, however then the wouldn't be sorted alphabetically? hmmm... –  David Alpert Jul 29 '09 at 22:00
1  
This is a great example, across all SE, of a well-executed poll. I especially like combining separate answers (for voting) and alphabetical index to them! –  Jonik Sep 17 '10 at 14:16
show 2 more comments

160 Answers

A little known one is

getmac

It shows the MAC address(es) of your network adapter(s).

Screenshot of running getmac from a Windows commandline window.

share
10  
+1 Nice! Didn't know about that one. Very useful! –  WaldenL May 5 '09 at 19:22
5  
ipconfig /all gives you this information in a less direct way too. –  LeopardSkinPillBoxHat May 11 '09 at 6:56
14  
Oh, MAC. It would be better if it ordered a Mac from the Apple store for you. ;-) –  Kyle Cronin Jun 10 '09 at 15:55
2  
THANK YOU! No more ipconfig /all and scrolling around! "Happy dance!" –  Gomibushi Mar 24 '10 at 20:41
show 5 more comments

In the command prompt type:

C:\> start .

It opens the current directory in the Windows Explorer.

share
2  
How neat. it works just like "ii ." in powershell. –  Sung May 4 '09 at 15:34
5  
You could also do "explorer ." –  Manuel Ferreria May 9 '09 at 17:14
2  
start actually works for any file type you can double-click on (word documents, xls files, etc) as well as drive mappings (not just the current working directory). –  Kyle Burton May 27 '09 at 16:40
5  
Note that start can be a bit funny if you have files with spaces in their names. If start's first argument is quoted, it interprets it as a request to change the window title. So instead of running: start "My File.txt" you have to enter: start "" "My File.txt" This drove me nuts until someone explained it to me! –  Ken Keenan Jun 28 '09 at 20:39
show 3 more comments
Remote Desktop Connection
mstsc.exe

Opens:

Some image demonstrationg the use of mstsc.exe.

share
16  
Even better with the /v: switch. Just Win+R, then "mstsc /v:computer.fabrikam.com" –  Portman May 4 '09 at 3:31
9  
renamed to /admin switch these days, and behaves quite differently in 2008+ –  Oskar Duveborn May 4 '09 at 10:04
17  
don't forget the /span option for creating really big sessions across two monitors. –  SqlACID May 4 '09 at 14:35
6  
Renamed back to /console in Vista SP1 and later, because they shouldn't have changed it in the first place. :) –  Mark Allen May 5 '09 at 21:00
7  
While we're at it, I also often use /w: and /h: to manually set width and height. I'm particularly fond of running IIS Manager in 800x800 for some reason. –  Portman May 6 '09 at 0:08
show 7 more comments

A list I use a lot:

  • nbtstat - List NetBIOS stats and information
  • netstat - List TCP/IP stats and information
  • ipconfig - List TCP/IP configuration for a system
  • netsh - Network configuration for a system
  • sc - manage services
  • net - whole slew of commands to manage users and groups, shares, connections, etc.
  • ping - makes sure a system is up on the network
  • tracert - trace the hops between two hosts. useful to see if there's a break in between and where it is.
  • nslookup - Query DNS for information
  • dcdiag - check health of the domain controller
  • setspn - check SPNs for Kerberos configuration
share
4  
+1 for an actual list of command line tools, and not just ways to start MMC. –  WaldenL May 5 '09 at 19:24
1  
sc allows you to control services, and it allows you to do so remotely. This is different from net start/net stop, which run locally (albeit you can use psexec or something like that to get to a console on a remote system). sc will also query the service, etc. Basically everything you can do from services.msc you can now do from the command-line. technet.microsoft.com/en-us/library/cc754599.aspx –  K. Brian Kelley May 9 '09 at 11:23
1  
netsh seems like a really powerful command, but I have not really been able to work with it. What do people really use it for? –  railmeat Aug 11 '09 at 2:33
show 3 more comments

Services control panel:

services.msc
share
show 4 more comments
shutdown.exe

allow you to shutdown or reboot a machine. You can even reboot a remote machine with

shutdown -m \\server -t 0 -r

It even comes with a graphical user interface

shutdown -i

and you can abort a shutdown with

shutdown -a
share
show 4 more comments

Robocopy is really useful. It mirrors directories.

It is great for backups, restoring, and transferring large amounts of files. It only transfers files which have changed and can resume from where it left off.

It comes standard in Windows Vista and later, but Windows XP users can get it as part of the Windows Server 2003 Resource Kit (free) or later.

share
1  
hehe. Well I guess it's a swiss-army-knife of command line copying, but with no GUI nonsense. –  thomasrutter May 6 '09 at 1:33
show 6 more comments

(Not really a command per-se, but a way to get there.)

For those of you that find yourself going to Start > Run > "cmd" a lot, you can cut down some steps.

Say you want to get your IP address. You would normally go Start > Run > "cmd" [enter] then...

ipconfig [enter]

Now instead, go...

Start > Run > "cmd /k ipconfig"

This will run cmd and the command 'ipconfig', and it will keep the window open. So if I want to quickly get my MAC address (physical address), I'd do:

 cmd /k ipconfig /all

...all from the run menu in one line.


All courtesy of BostonMark

share
3  
Yes, the /k flag is definitely one of the best tips here. –  Abraham Vegh May 17 '09 at 2:26
10  
Here's a better way: Go to START > All Programs > Accessories > Command Prompt, and right-click. Select Properties. Click the 'Short-cut' tab. Put the cursor in the 'Shortcut Key' field. Press [ctrl]-[alt]-t, it should say "Ctrl+Alt+T". Click OK. Now you can launch cmd.exe from anywhere anytime by hitting ctrl-alt-t. –  Ryan Fisher Jun 2 '09 at 21:25
5  
Also, using windowskey+r gets you directly to the "Run..." window. –  Andor Mar 16 '10 at 18:32
1  
How is this quicker or fewer keystrokes than opening cmd and typing the command? Seems to me two more keystrokes than the way you're proposing to replace. –  harpo Oct 3 '10 at 5:27
show 1 more comment

The forgotten art: DOS String Manipulation!

set mydate=%date:~10,4%_%date:~4,2%_%date:~7,2%
echo %mydate%

Output will be YYYY_MM_DD.

Copy and paste this into a .bat file and be amazed! This is especially useful for creating backups, or any time/date series of directories and files.

An example:

@echo off
:: Yes, this looks bad, but it works, it sets the file veriable mydate to YYYY_MM_DD.
set mydate=%date:~10,4%_%date:~4,2%_%date:~7,2%

echo Backing up DC1:
:: start a new backup session, the /M switch is for the type of bakcup being performed, type ntbackup /? for more info
start /wait ntbackup backup \\DC1\c$ /j "DC1 Backup" /f "C:\BAK\DC1\DC1_%mydate%.bkf" /M incremental
echo DC1 is Done

echo Backing up EXCH:
start /wait ntbackup backup \\EXCH\c$ /j "EXCH Backup" /f "C:\BAK\EXCH\EXCH_%mydate%.bkf" /M incremental
echo EXCH is Done

echo Backing up FS1:
start /wait ntbackup backup \\FS1\c$ /j "FS1 Backup" /f "C:\BAK\FS1\FS1_%mydate%.bkf" /M incremental
echo FS1 is Done

echo Backup was completed %date% %time%
pause
share
4  
+2. wow. this is impressive. this is almost as mind blowing as the first time I saw someone use the for command at the command-line. –  MikeJ Aug 10 '09 at 20:47
1  
+1 I wish I'd known about this 10 years ago. –  Kelly S. French Aug 28 '09 at 15:00
5  
This is dangerous as hell as the system locale display format changes the string that date returns and hence will thrash any script based on character position into an unpredictable mess if it ever changes. Which at least in Europe can easily happen by mistake or on purpose - I've had scheduled batch scripts do horrible things (or nothing) because of exactly this ^^ –  Oskar Duveborn Jun 13 '10 at 11:23
show 1 more comment
tasklist.exe

will list processes on local or a remote machine.

tasklist.exe /S server

It can display which Services the scvhost.exe processes are hosting with

tasklist /SVC

You can also do some filtering. This will display the processes on a remote machine that have used more than 15 minutes of CPU time

tasklist /S server /FI "CPUTIME gt 00:15:00"
share
1  
+1 for the /svc flag, that's really useful! –  Curtis May 29 '09 at 16:52
1  
Don't forget it's counterpart taskkill –  Chris S Jul 8 '10 at 3:39
add comment

control userpasswords2

Opens the classic User Accounts dialog:

enter image description here

share
add comment

I find that I use findstr a lot to find stuff in logs, error files, etc.

A simple example: in the log file ex0905.log we find all lines that have 2009-05-05 in them:

findstr "2009-05-05" ex0905.log
share
1  
findstr /s find recursively –  Alex. S. May 9 '09 at 5:30
show 1 more comment
Programs and Features (Formerly known as "Add or Remove Programs")
appwiz.cpl

Opens

alt text

share
1  
+1 for 256-colour greatness! –  Mark Henderson Oct 8 '09 at 2:34
show 3 more comments

Sometimes I have to worry about too few free sessions for a Terminal Server connection to a server.

quser displays information about user sessions on a terminal server.

quser /SERVER:myserver

Output

C:\Documents and Settings\sysmanager01>quser /SERVER:serverx
USERNAME                    SESSIONNAME        ID  STATE   IDLE TIME  LOGON TIME
usr_hot1                                        1  Disc        none   30.04.2009 17:59
usr_hot                                         2  Disc        none   30.04.2009 18:01
appsuperuser                rdp-tcp#6           3  Conn            .  01.01.1601 02:00

Sometimes it's even possible to find pure workaholics like appsuperuser :-)

It's easier when pasting the quser executable from any 32-bit Server to my local System32 folder.

share
6  
Try using qwinsta instead, it's included by default in clients like XP as well... rwinsta can nuke the sessions –  Oskar Duveborn May 7 '09 at 13:43
show 1 more comment

I use

qwinsta

to see disconnected remote desktop sessions and

logoff

to end them.

It works on Windows 2000, Windows XP, Windows Vista, Windows Server 2003 and probably Windows Server 2008 (never tried).

share
show 3 more comments
systeminfo

Displays a ton of information about the system at hand. The following are what it outputs on Vista:

  • Host Name
  • OS Name
  • OS Version
  • OS Manufacturer
  • OS Configuration
  • OS Build Type
  • Registered Owner
  • Registered Organization
  • Product ID
  • Original Install Date
  • System Boot Time
  • System Manufacturer
  • System Model
  • System Type
  • Processor(s)
  • BIOS Version
  • Windows Directory
  • System Directory
  • Boot Device
  • System Locale
  • Input Locale
  • Time Zone
  • Total Physical Memory
  • Available Physical Memory
  • Page File
  • Max Size
  • Page File
  • Available
  • Page File
  • In Use
  • Page File Location(s)
  • Domain
  • Logon Server
  • Hotfix(s)
  • Network Card(s)
share
show 1 more comment
Computer Management
compmgmt.msc

Opens
enter image description here

share
add comment

Very useful one I only found out about recently:

winver.exe

Gives you a dialog box with the version of Windows the machine is running, complete with Service Pack level and build number.

share
9  
Note that I use the hotkey Win+Pause to see most of this information quickly on a box. –  Matthew May 27 '09 at 20:29
add comment

There is still no mention of WMIC.exe :)

Find whatever you want from remote machine, local machine... multiple machines.

Nicely filled out HTML page with all data related to OS

WMIC OS get /all /format:htable

Look at all the options available

ALIAS                    - Access to the aliases available on the local system
BASEBOARD                - Base board (also known as a motherboard or system board) management.
BIOS                     - Basic input/output services (BIOS) management.
BOOTCONFIG               - Boot configuration management.
CDROM                    - CD-ROM management.
COMPUTERSYSTEM           - Computer system management.
CPU                      - CPU management.
CSPRODUCT                - Computer system product information from SMBIOS.
DATAFILE                 - DataFile Management.
DCOMAPP                  - DCOM Application management.
DESKTOP                  - User's Desktop management.
DESKTOPMONITOR           - Desktop Monitor management.
DEVICEMEMORYADDRESS      - Device memory addresses management.
DISKDRIVE                - Physical disk drive management.
DISKQUOTA                - Disk space usage for NTFS volumes.
DMACHANNEL               - Direct memory access (DMA) channel management.
ENVIRONMENT              - System environment settings management.
FSDIR                    - Filesystem directory entry management.
GROUP                    - Group account management.
IDECONTROLLER            - IDE Controller management.
IRQ                      - Interrupt request line (IRQ) management.
JOB                      - Provides  access to the jobs scheduled using the schedule service.
LOADORDER                - Management of system services that define execution dependencies.
LOGICALDISK              - Local storage device management.
LOGON                    - LOGON Sessions.
MEMCACHE                 - Cache memory management.
MEMLOGICAL               - System memory management (configuration layout and availability of memory).
MEMPHYSICAL              - Computer system's physical memory management.
NETCLIENT                - Network Client management.
NETLOGIN                 - Network login information (of a particular user) management.
NETPROTOCOL              - Protocols (and their network characteristics) management.
NETUSE                   - Active network connection management.
NIC                      - Network Interface Controller (NIC) management.
NICCONFIG                - Network adapter management.
NTDOMAIN                 - NT Domain management.
NTEVENT                  - Entries in the NT Event Log.
NTEVENTLOG               - NT eventlog file management.
ONBOARDDEVICE            - Management of common adapter devices built into the motherboard (system board).
OS                       - Installed Operating System/s management.
PAGEFILE                 - Virtual memory file swapping management.
PAGEFILESET              - Page file settings management.
PARTITION                - Management of partitioned areas of a physical disk.
PORT                     - I/O port management.
PORTCONNECTOR            - Physical connection ports management.
PRINTER                  - Printer device management.
PRINTERCONFIG            - Printer device configuration management.
PRINTJOB                 - Print job management.
PROCESS                  - Process management.
PRODUCT                  - Installation package task management.
QFE                      - Quick Fix Engineering.
QUOTASETTING             - Setting information for disk quotas on a volume.
RECOVEROS                - Information that will be gathered from memory when the operating system fails.
REGISTRY                 - Computer system registry management.
SCSICONTROLLER           - SCSI Controller management.
SERVER                   - Server information management.
SERVICE                  - Service application management.
SHARE                    - Shared resource management.
SOFTWAREELEMENT          - Management of the  elements of a software product installed on a system.
SOFTWAREFEATURE          - Management of software product subsets of SoftwareElement.
SOUNDDEV                 - Sound Device management.
STARTUP                  - Management of commands that run automatically when users log onto the computer system.
SYSACCOUNT               - System account management.
SYSDRIVER                - Management of the system driver for a base service.
SYSTEMENCLOSURE          - Physical system enclosure management.
SYSTEMSLOT               - Management of physical connection points including ports,  slots and peripherals, and
TAPEDRIVE                - Tape drive management.
TEMPERATURE              - Data management of a temperature sensor (electronic thermometer).
TIMEZONE                 - Time zone data management.
UPS                      - Uninterruptible power supply (UPS) management.
USERACCOUNT              - User account management.
VOLTAGE                  - Voltage sensor (electronic voltmeter) data management.
VOLUMEQUOTASETTING       - Associates the disk quota setting with a specific disk volume.
WMISET                   - WMI service operational parameters management.

and many, many more.

share
show 1 more comment
color 02

This, my friends, is the only command you'll ever need. The rest is nonessential.

share
2  
Oops, I accidentally entered color 23... –  Andomar May 16 '09 at 19:26
show 2 more comments

Chaining commands, in particular net stop and start to restart any service:

net stop w3svc && net start w3svc

(It is a silly example as iisreset will do that, but anyway ;)

share
5  
Just pointing out this is actually conditional execution, unlike a single '&'. ss64.com/nt/syntax-conditional.html –  Christopher Galpin May 22 '09 at 19:25
3  
This will ensure a metabase configuration change is saved, however. IISRESET does not. –  K. Brian Kelley Jun 10 '09 at 16:03
show 2 more comments
explorer .

Open explorer with the current folder selected.

explorer /e, .

Open explorer, with folder tree, with current folder selected.

share
show 2 more comments

To change the title of the CMD window you have open, simply use:

title [your new title]

I've got a lot of CMD windows and other programs open at work. This command, combined with Taskbar Shuffle (allows you to drag taskbar items into new orders) has saved me from insanity.

share
add comment

Windows 7 Run Commands

I find it better to know where to find them until I have used them often enough to actually remember them.

share
show 1 more comment

To restart IIS

iisreset
share
3  
This can also be used to restart IIS on a remote server: iisreset remoteservername –  Saul Dolgin May 27 '09 at 17:58
3  
I don't use iisreset any longer. It may not save metabase config issue. I use net stop iisadmin /y && net start w3svc instead. Here's why: support.microsoft.com/default.aspx/kb/286196 –  K. Brian Kelley Jun 10 '09 at 16:02
show 1 more comment

I didn't see taskkill on the list yet.

TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T]

Parameter List: /S system Specifies the remote system to connect to.

/U    [domain\]user    Specifies the user context under which
                       the command should execute.

/P    [password]       Specifies the password for the given
                       user context. Prompts for input if omitted.

/F                     Specifies to forcefully terminate
                       process(es).

/FI   filter           Displays a set of tasks that match a
                       given criteria specified by the filter.

/PID  process id       Specifies the PID of the process that
                       has to be terminated.

/IM   image name       Specifies the image name of the process
                       that has to be terminated. Wildcard '*'
                       can be used to specify all image names.

/T                     Tree kill: terminates the specified process
                       and any child processes which were started by

it.

Works great in conjunction with tasklist

share
add comment

You can hit F7 in The Windows Command Line for a history of commands that you can choose with your keyboard.

Also...I love this one - you can copy a file path by just dragging a file into the command line.

share
add comment

On Windows XP at least (I haven't tried on Windows Vista and Windows 7):

appwiz.cpl @,2

It takes you straight to the Add/Remove Windows Components pane.

Another way to add or remove components in an automated fashion is to use

sysocmgr.exe

in unattended mode with a .inf file that lists the components you'd like to install. For example,

[NetOptionalComponents] 
SNMP = 1 

[SNMP] 
Contact_Name = IT Dept. 
Location = Office
Service = Physical, Applications, End-to-End 
Community_Name = Mormon 
Traps = server1, server2 
Send_Authentication = Yes 
Accept_CommunityName = Public:Read_Only 
Any_Host = No 
Limit_Host = server1, server2

(Credit due to thesystemadministrator.com for .inf file.)

It's a clunky tool (hey, it's MS), but it's invaluable for getting your components sorted out post-install.

share
1  
"appwiz.cpl @,2" works but renamed to "Turn Windows Features On and Off" –  Sung May 4 '09 at 23:39
add comment
Device Manager
devmgmt.msc

Opens

enter image description here

share
7  
If you set the environment variable devmgr_show_nonpresent_devices to 1 before launching device manager, then when you show hidden devices it will show all the completely inactive devices (e.g. have been removed) as well. –  Richard May 4 '09 at 9:35
add comment

Registry Editor

regedit
share
add comment

protected by Iain Dec 11 '11 at 14:08

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.