vote up 190 vote down star
321

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

flag
8  
If you find this stuff interesting, take a look at commandlinefu: commandlinefu.com It's basically like digg for CLI – username May 11 at 6:47
show 4 more comments

134 Answers

1 2 3 4 5
vote up 86 vote down

A little known one is

getmac

Shows the mac address(es) of your network adapter(s)

alt text

link|flag
8  
+1 Nice! Didn't know about that one. Very useful! – WaldenL May 5 at 19:22
4  
ipconfig /all gives you this information in a less direct way too. – LeopardSkinPillBoxHat May 11 at 6:56
7  
Oh, MAC. It would be better if it ordered a Mac from the Apple store for you. ;-) – Kyle Cronin Jun 10 at 15:55
show 5 more comments
vote up 47 vote down

In the command prompt type:

C:\> start.

opens the current directory in the Windows Explorer.

link|flag
2  
How neat. it works just like "ii ." in powershell. – Sung Meister May 4 at 15:34
5  
You could also do "explorer ." – Manuel Ferreria May 9 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 at 16:40
1  
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 at 20:39
show 2 more comments
vote up 40 vote down

Services control panel:

services.msc
link|flag
show 3 more comments
vote up 37 vote down
Remote Desktop Connection
mstsc.exe

Opens
alt text

link|flag
10  
Even better with the /v: switch. Just Win+R, then "mstsc /v:computer.fabrikam.com" – Portman May 4 at 3:31
3  
Also the /console switch – luapyad May 4 at 3:54
7  
renamed to /admin switch these days, and behaves quite differently in 2008+ – Oskar Duveborn May 4 at 10:04
12  
don't forget the /span option for creating really big sessions across two monitors. – SqlACID May 4 at 14:35
6  
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 at 0:08
show 6 more comments
vote up 35 vote down

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
link|flag
2  
+1 for an actual list of command line tools, and not just ways to start MMC. – WaldenL May 5 at 19:24
show 5 more comments
vote up 32 vote down

Robocopy is really useful. It mirrors directories.

Great for backups/restoring/transferring large amounts of files. Only transfers files which have changed, and can resume from where it left off.

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

link|flag
1  
hehe. Well I guess it's a swiss-army-knife of command line copying, but with no GUI nonsense. – thomasrutter May 6 at 1:33
show 4 more comments
vote up 31 vote down
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
link|flag
show 3 more comments
vote up 25 vote down

(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

link|flag
2  
Yes, the /k flag is definitely one of the best tips here. – abrahamvegh May 17 at 2:26
8  
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. – mystikphish Jun 2 at 21:25
show 2 more comments
vote up 21 vote down

control userpasswords2

Opens the classic User Accounts dialog:

User Accounts

link|flag
vote up 18 vote down

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

Its not grep by when you have a base install without it it works just fine.

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
link|flag
show 1 more comment
vote up 17 vote down
Programs and Features (Formerly Known as "Add or Remove Programs")
appwiz.cpl

Opens
alt text

link|flag
show 3 more comments
vote up 17 vote down
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"
link|flag
1  
+1 for the /svc flag, that's really useful! – Curtis May 29 at 16:52
vote up 15 vote down

Sometimes I have to worry about too few free Sessions for 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 pureworkaholics like appsuperuser :-)

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

link|flag
3  
Try using qwinsta instead, it's included by default in clients like XP as well... rwinsta can nuke the sessions – Oskar Duveborn May 7 at 13:43
show 1 more comment
vote up 14 vote down
Computer Management
compmgmt.msc

Opens
alt text

link|flag
vote up 12 vote down

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.

link|flag
4  
Note that I use the hotkey Win+Pause to see most of this information quickly on a box. – Matthew May 27 at 20:29
vote up 12 vote down

I use

qwinsta

to see disconnected remote desktop sessions and

logoff

to end them.

Works on 2000, XP, Vista, Server 2003 and probably Server 2008 (never tried).

link|flag
show 2 more comments
vote up 11 vote down

Behold! 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
link|flag
show 2 more comments
vote up 10 vote down

To restart IIS

iisreset
link|flag
3  
This can also be used to restart IIS on a remote server: iisreset remoteservername – Saul Dolgin May 27 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 at 16:02
vote up 10 vote down

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

net stop w3svc && net start w3svc

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

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

On Windows XP at least, haven't tried Windows Vista/Windows 7:

appwiz.cpl @,2

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, e.g.

[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.

link|flag
1  
"appwiz.cpl @,2" works but renamed to "Turn Windows Features On and Off" – Sung Meister May 4 at 23:39
vote up 9 vote down
Device Manager
devmgmt.msc

Opens
alt text

link|flag
5  
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 at 9:35
vote up 9 vote down
explorer .

Open explorer with the current folder selected.

explorer /e, .

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

link|flag
show 2 more comments
vote up 9 vote down

Registry Editor

regedit
link|flag
vote up 9 vote down

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.

link|flag
vote up 9 vote down
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)

link|flag
show 1 more comment
vote up 9 vote down

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.

link|flag
show 1 more comment
vote up 8 vote down
EventViewer
eventvwr.msc

Opens alt text

link|flag
1  
You can just use "eventvwr" and save a few characters. – boflynn May 4 at 10:57
vote up 8 vote down
color 02

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

link|flag
1  
Oops, I accidentally entered color 23... – Andomar May 16 at 19:26
vote up 7 vote down

fsutil

From Microsoft Technet "Performs tasks that are related to file allocation table (FAT) and NTFS file systems, such as managing reparse points, managing sparse files, or dismounting a volume."

One of its most helpful options is to disable the creation of legacy 8.3 filenames. This is particularly helpful on servers that have very large numbers of files in a directory with long filenames.

To disable legacy 8.3 filenames on XP or Server 2003:

fsutil behavior set disable8dot3 1

On Windows 7 (and possibly Vista and Server 2008) you'd use:

fsutil 8dot3name set 1

For more information see: http://technet.microsoft.com/en-us/library/cc753059.aspx

link|flag
show 1 more comment
vote up 7 vote down

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

link|flag
1 2 3 4 5

Your Answer

Get an OpenID
or
never shown

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