# Useful Command-line Commands on Windows

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.

• Application name
• Commands
• Screenshot (Optional)

Shortcut to commands

## locked by ZypherDec 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. See the help center for guidance on writing a good question.

• 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
• great list, very usefull – Adyt May 20 '09 at 8:56
• Try putting each command as a separate answer. Then we can vote and comment on each one. – lamcro Jun 26 '09 at 12:22
• 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
• 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

"| more" is an essential sub-command. It pauses at each screen, making large amounts of text easier to read.

Examples:

dir | more
help | more
type filename.txt | more


It saves from scrolling back up to find what you want, and losing your place.

• more is already listed in the "question", but it's useful to have it described. However, it's unnecessary for dir because it has /p. Also, it's unnecessary to pipe type into more, just do more filename.txt (congratulations, you receive the Windows/DOS equivalent of the Useless Use of cat Award). – Dennis Williamson Jul 28 '10 at 20:54
• Yes, I checked before posting and noticed that more was mentioned, but it didn't summarize how. While there are alternative ways to pause the screen, 'more' is consistent across all outputs ... and works with other OSes too (including non-Windows). To me, it's an essential subtool to add to any arsenal of command line syntax lists. – Scott Forsyth - MVP Jul 29 '10 at 19:28

sqlwb Starts Microsof SQL Server Management Studio. Handy when you can't find it listed in the start menu, but you know it's installed on that server. :)

Amazing Shutdown timer:

shutdown -s -t 7200 -c "shutting down in 120 mins, please type 'shutdown -a' in a command prompt to cancel" -f


System Properties

The command

sysdm.cpl


opens

• also available through [windowsbutton]+[break]. – Yuval Jun 30 '09 at 4:54

cls clears the command line screen.

It is very useful when you want to run a new command and clear the current screen.

If you're on one of the more professional Windows distributions (XP Professional, Vista Business, Vista Ultimate), use

gpedit.msc


to do Group Policy editing.

The command

powercfg.cpl


launches the power management control panel applet.

• This looks awefully useful on my laptpo! – dance2die May 27 '09 at 14:42

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


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.

• to get to backslashes you need to escape each of the backslashes, thus you'll need to enter 4 :) – serverhorror Jun 12 '09 at 17:01
• I have a /bin folder in my home dir, and I configure my profile to include h:/bin in my path. I drop pstools, gnu32utils, wrktools, etc. into here. If you have roaming profiles, you have all your utils available in the path across the entire network. – Bryan Dec 11 '11 at 20:40

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

odbcad32.exe


Opens

• Is it wrong to be happy not to have seen this screen in years? – p.campbell May 4 '09 at 22:28
• @Philoushka I had to see that screen everyday while setting up some 3rd party Mail application that interacts with Accounting system... – dance2die May 4 '09 at 22:36
Internet Information Services (IIS) Manager
InetMgr.exe - IIS 7
InetMgr6.exe - IIS 6

• IIS 7

• IIS 6

• God´s home is on Vista? – Decio Lira May 4 '09 at 12:59
• @Decio: Beh, it's all capitalized ;) – dance2die May 4 '09 at 13:27

• Ctrl-Shift-Esc uses fewer keys to open Task Manager. – Ryan Bolger May 4 '09 at 5:29
desk.cpl


opens the display properties. (Sorry, no image)

• @Yuval: Don't worry. When I get enough rep to be able to edit wiki, I will add a screenshot – dance2die May 4 '09 at 13:25

Best way to avoid clicks is to stay on the command line. A directory in your path with the GNU tools and the sysinternals tools will go a long way to making your life simpler. Nothing that a good grep can't fix. :-)

My favorites:

ipconfig
tracert
ping
telnet


notepad

dsa.msc


is a nice quick way to open up Active Directory Users and Computers.

firewall.cpl


Opens the Windows Firewall settings.

System Configuration

msconfig


It is very useful to see what runs at startup

To allow user to log on without pressing ctrl-alt-delete, or log on without entering a password:

control userpasswords2


Years ago I started using sync.exe (for file cache flushing) from the NTinternals guys. I've been migrating that binary around for maybe a decade, and it still works. Their company got assimilated by Microsoft, but the binaries are still hanging around on the net if you search.

I've found Launchy to be a very useful tool for Windows. It lets you launch many programs that would normally be launched by clicking icons by typing a few keystrokes. There's also a version for Linux. It can be found at www.launchy.net, and is free and open-source.

For example, to open an Explorer window from anywhere, type Alt-space (the default Launchy hot-key) followed by "c:\" followed by Enter. You can run any program for which you have a Windows shortcut by typing a few characters from the name of the shortcut. For example: Alt-space "co" Enter brings up Control Panel. You can also do Google searches, open URLs in the browser, and many other things without taking your fingers from the keyboard.

Here is a VBScript that will do elevation when you RUNAS in Vista:

Set objShell = CreateObject("Shell.Application")
app = wscript.arguments(0)
args = ""
for i = 1 to (WScript.Arguments.length - 1)
args = args + wscript.arguments(i)
next
objShell.ShellExecute app, args, "", "runas"


Use like so: runas.exe /user:domain\user "wscript.exe runas_script.vbs mmc.exe"

The following web site shows how to create command line shortcuts to anything using the Windows registry key, "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths".

Customizing Windows Run Command
http://weblogs.asp.net/whaggard/archive/2004/04/11/111232.aspx

at


Gives you a way to schedule tasks either locally or remotely without using Scheduled Tasks.

Running a command every Friday

AT 23:30 /EVERY:f c:\backups\weekly.cmd


When starting the services control panel for the first time, on a fresh install;

services.msc /a


then choose the "standard"-tab, move the description column all the way to the right, and then File -> Save the new layout.

Query Domain Controllers @ netdom /query /domain:MyDomainName fsmo

• pushd/popd to move around directories in a stack style