up vote 215 down vote favorite
369

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

link|flag
10  
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
show 4 more comments

148 Answers

1 2 3 4 5
up vote 90 down vote

A little known one is

getmac

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

alt text

link|flag
9  
+1 Nice! Didn't know about that one. Very useful! – WaldenL May 5 '09 at 19:22
4  
ipconfig /all gives you this information in a less direct way too. – LeopardSkinPillBoxHat May 11 '09 at 6:56
8  
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
1  
THANK YOU! No more ipconfig /all and scrolling around! "Happy dance!" – Gomibushi Mar 24 at 20:41
show 5 more comments
up vote 49 down vote

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 '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
3  
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
up vote 43 down vote
Remote Desktop Connection
mstsc.exe

Opens
alt text

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

Services control panel:

services.msc
link|flag
show 4 more comments
up vote 39 down vote

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

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 '09 at 1:33
show 4 more comments
up vote 31 down vote
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
up vote 26 down vote

(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 '09 at 2:26
9  
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
2  
Also, using windowskey+r gets you directly to the "Run..." window. – Andor Mar 16 at 18:32
show 1 more comment
up vote 21 down vote

control userpasswords2

Opens the classic User Accounts dialog:

User Accounts

link|flag
up vote 20 down vote

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
up vote 19 down vote
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 '09 at 16:52
show 1 more comment
up vote 18 down vote

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
3  
+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 French Aug 28 '09 at 15:00
1  
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 at 11:23
up vote 17 down vote
Programs and Features (Formerly Known as "Add or Remove Programs")
appwiz.cpl

Opens
alt text

link|flag
show 4 more comments
up vote 17 down vote

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
5  
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
up vote 14 down vote
Computer Management
compmgmt.msc

Opens
alt text

link|flag
up vote 13 down vote

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 '09 at 20:29
up vote 13 down vote

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 3 more comments
up vote 11 down vote

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
up vote 11 down vote
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
up vote 11 down vote
color 02

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

link|flag
2  
Oops, I accidentally entered color 23... – Andomar May 16 '09 at 19:26
show 2 more comments
up vote 10 down vote
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
up vote 10 down vote

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 '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
up vote 10 down vote

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 '09 at 19:25
1  
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
up vote 10 down vote

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 '09 at 23:39
up vote 9 down vote
Device Manager
devmgmt.msc

Opens
alt text

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

Registry Editor

regedit
link|flag
up vote 9 down vote

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

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
up vote 8 down vote
EventViewer
eventvwr.msc

Opens alt text

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

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.

link|flag
show 1 more comment
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.