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

160 Answers 160

To open the Windows Event Log (Event Viewer).

Eventvwr

enter image description here

share

To free up some disk space:

format c:

No, really, here's Disk Cleanup:

cleanmgr.exe

enter image description here

share

control userpasswords2

Opens the classic User Accounts dialog:

enter image description here

share
Internet Information Services (IIS) Manager
InetMgr.exe - IIS 7
InetMgr6.exe - IIS 6
  • IIS 7
    enter image description here

  • IIS 6
    enter image description here

share
Internet Properties
inetcpl.cpl

Opens
enter image description here

share

enter image description here#####Mouse Properties control mouse

-- or --

main.cpl

Opens

share
Regional and Language Options
intl.cpl

Opens
enter image description here

share
Network and Sharing Center
control.exe /name Microsoft.NetworkAndSharingCenter

Reference: http://technet.microsoft.com/en-us/library/cc733147.aspx#BKMK_Anchor3

Opens
enter image description here

share
Keyboard Properties
control keyboard

Opens
enter image description here

share
ODBC Data Source Administrator
odbcad32.exe

Opens
enter image description here

share
Disk Management
diskmgmt.msc

Opens
enter image description here

share
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
Computer Management
compmgmt.msc

Opens
enter image description here

share
EventViewer
eventvwr.msc

Opens enter image description here

share
1  
You can just use "eventvwr" and save a few characters. –  boflynn May 4 '09 at 10:57

The clip command on Windows Vista and Windows Server 2008 is very useful: it puts anything passed in on standard input on the clipboard.

Examples:

Copy current directory to clipboard:

dir | clip

List C files containing a particular string:

findstr /i /s /m /c:"someFunction" *.c | clip
share

print %logonserver%

A very quick and easy way to view the DC that your workstation has authenticated against. Useful when working with GPO's and scripts.

share

The arp command gives you the IP address and Ethernet address for hosts your machine knows of on the network. Very useful to debug hairy network troubles... I usually use

arp -a
share

I seem to regularly use "sc stop wuauserv", which turns off the Windows Update service. Primarly to make it stop nagging me to restart every few minutes.

share

Windows Update Service

wuauclt.exe 

/demoui
/a /ResetAuthorization
/r /ReportNow
/detectnow

This single command has a lot of mythology surrounding it. It reports no errors, has no help dialog, and the only real output is run for /demoui. But it does work, I think.

Reference

share

chkdsk (or checkdisk) is a command that checks the disk surface for physical errors or bad sectors. It can also fix logical file system errors.

Picture

share
bootsect.exe {/help | /nt52 | /nt60} {SYS | ALL | <DriveLetter:>} [/force]

From Bootsect Command-Line Options:

Bootsect.exe updates the master boot code for hard disk partitions to switch between BOOTMGR and NTLDR. You can use this tool to restore the boot sector on your computer.

Mind you that this tool is only available on the Windows installation DVD under the BOOT folder. (I think only Windows Vista or higher.)

share

Disk management from the command line:

diskpart

See A Description of the Diskpart Command-Line Utility for more information.

share

Useful for batch/cmd processing:

cd %0\..

changes the path including the drive to the directory where the batch/cmd files is located.

For example, when you have your bat/cmd in z:\test, and you open up a shortcut to the bat/cmd from your desktop, with the command inside your bat/cmd you can change the path to z:\test and go on from there.

Edit: the command above only changes the path, not the drive! My fault... I tested it only on the same drive. The correct command for also changing the drive would be

cd /d %0\..
share

cacls (or the more up-to-date icalcs):

cacls (Change Access Control Lists) is a command line utility for Microsoft Windows to change Access Control List (ACL) permissions on a directory, its subcontents, or files. An access control list is a list of permissions for a securable object, such as a file or directory, that controls who can access it.

alt text

It is a real life-saver on a file-server when specific file(s) and/or directory(s) permissions have to be modified.

share

Run dxdiag, a DirectX diagnostic tool. Apart from giving DirectX components installed on your system it also gives a system information summary. All information can be exported as a text file.

CIPHER: this is a good one to permanently delete files off the computer. Once a file is deleted, it is only marked as deleted and it won't truly be delted off the hard drive until it's overwritten with the information or you can run cipher and the location of where the file used to be to truly delete it from the hard drive.

Usage:

cipher /w:"drive letter":"folder name"  

Example:

 cipher /w:C: (to do all the C: drive.) 
share

psexec

While it's from Sysinternals, the sysinternals tools are so essential and commonly installed on servers they might as well be part of the OS.

psexec \\targetserver -w "d:\bin" "cmd" 

You now have an interactive shell on a remote computer. Enter "exit" to come back home. I will often use it to apply something to a group of servers as follows.

set srvs=server1 server2 server3 
set execthis=[something useful]
for %s IN (%srvs%) DO (
start psexec \%s -u domain\someUser -p superSecretOfCourse "cmd" "/C %execthis%" 
)

Here I show several handy tricks:

  1. Use for loops to execute a command multiple times (from batch use %%s instead of %s)
  2. Start to open a window in a new process - handy if each operations takes a few minutes.
  3. Psexec can use windows auth or a login. Noting that integrated auth usually won't hop from local to server to a third location (e.g. SAN) - provide user and password if you need to access a network resource
share

If you have pstools installed in the root of drive C;

c:\pstools\psexec \\\\computername -u username -p password cmd

opens the command prompt on a remote machine. From there you can do whatever you want.

share

DIRCMD is an environmental variable that the DIR command reads its switches from.

Order directory listing by sub-directories, file extension, and name, including hidden and system files:

set DIRCMD=/ogen/a

dir
share

Use

httpcfg [query | set | delete] iplisten [ip address]

to find out or change the IP addresses IIS is listening on

(If you want to run IIS and some other HTTP server on the same box and port with different IP addresses.)

share

Get the current day, month and year into environment variables (adjust for locale).

Command line:

for /f "tokens=2,3,4 delims=/ " %a in ('echo %date%') do set mon=%a && set day=%b && set year=%c

Or in a batch file:

for /f "tokens=2,3,4 delims=/ " %%a in ('echo %date%') do set mon=%%a && set day=%%b && set year=%%c

Other stuff

ipconfig /displaydns

WMIC - command line access to WMI

dsqery, dsget, dsmod, dsadd - command line access to AD

net localgroup

for /f %%a (' some command ') do call :sub %%a

Use :: instead of REM in batch files.

nbtstat

NTRIGHTS.EXE grant sePriveleges

Set /P for prompting.

IF ELSE in batch:

IF EXIST filename. (
    del filename.
) ELSE (
    echo filename. missing.
)
share

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.