Command Prompt Windows 10: A Step-by-Step Guide
In this article
To open Command Prompt in Windows 10, press the Windows key, type cmd or Command Prompt, and press Enter. For administrative tasks, right-click the result and choose Run as administrator. That is the short answer. This guide walks you through opening it safely, running basic commands, and fixing common problems. No extra software is required—Command Prompt is built into Windows 10.
What You'll Need
- A PC running Windows 10.
- Keyboard and mouse (or touchpad).
- Administrator rights if you plan to run system-level commands; standard users can still open a normal Command Prompt.
Step-by-Step
- Open the Start menu. Click the Windows logo at the bottom-left of the screen or press the Windows key on your keyboard.
- Search for Command Prompt. Type cmd or Command Prompt into the search box. The search results will show the Command Prompt app. (Menu labels and search results can differ slightly depending on your Windows 10 version and region.)
- Launch it. Click Command Prompt in the results, or press Enter if it is already highlighted. A black window with a blinking cursor and a prompt like
C:\Users\YourName>will appear. - Run as administrator (optional but often needed). If a command requires elevated privileges (for example,
sfc /scannoworchkdsk), close the normal window, search again, right-click Command Prompt, and select Run as administrator. Click Yes on the User Account Control prompt. The window title will start with “Administrator:”. - Try a simple command. Type
dirand press Enter. This lists the files and folders in your current directory. It is a safe way to confirm the prompt is working. - Navigate folders. Use
cdfollowed by a folder name to change directory. For example,cd Documentsmoves into the Documents folder. Typecd ..to go up one level. To see the full path of your current folder, typecdand press Enter. - Get help on any command. Type the command followed by
/?(for example,ipconfig /?) and press Enter to see a list of options and syntax. This is the built-in manual. - Clear the screen. Type
clsand press Enter to remove previous output and start with a clean window. - Close Command Prompt. Type
exitand press Enter, or click the X in the top-right corner. Closing the window ends the session; any commands still running will stop.
These steps cover the basics. Once you are comfortable, you can explore commands like ping (test network connectivity), ipconfig (view network settings), and systeminfo (display system details). Always read what a command does before running it, especially with administrator rights.
Common Mistakes
- Running destructive commands without understanding them. Commands like
format,diskpart, ordelcan erase data. Double-check syntax and never copy commands from untrusted sources. - Forgetting to run as administrator. Many system commands fail with “Access is denied” if the window is not elevated. If you see that error, reopen Command Prompt as administrator.
- Typing commands in the wrong folder. Commands like
dirorcdact on the current directory. Usecdto navigate first, or provide a full path. - Confusing Command Prompt with PowerShell. They are separate tools. Some commands work in both, but not all. If a guide says “open PowerShell,” use PowerShell, not Command Prompt.
- Leaving the window open during long tasks. Closing the window stops the running command. If a command is still working, wait for the prompt to return before closing.
Tips
- Use Tab completion. Start typing a file or folder name and press Tab to auto-complete it. This reduces typos.
- Access previous commands. Press the Up Arrow key to cycle through commands you have already entered.
- Copy and paste. Right-click inside the window to paste. To copy, select text with the mouse and press Enter, or right-click and choose Mark, then select and press Enter.
- Open Command Prompt from any folder. In File Explorer, click the address bar, type
cmd, and press Enter. The prompt opens in that folder. - Pin it to Start or taskbar. After searching for Command Prompt, right-click it and choose Pin to Start or Pin to taskbar for quick access.
- Keep a cheat sheet. Common commands like
ipconfig,ping,tracert, andsfc /scannoware worth memorizing for troubleshooting.
Troubleshooting
- Command Prompt won't open. Restart your PC and try again. If it still fails, check for Windows updates (Settings > Update & Security > Windows Update). You can also try opening it from the System32 folder: navigate to
C:\Windows\System32in File Explorer and double-clickcmd.exe. - “Access is denied” errors. You are likely running a command that requires administrator rights. Close the window, reopen Command Prompt as administrator, and retry.
- Commands are not recognized. Check spelling and spacing. Some commands are only available in specific folders or require additional tools. Use
/?to see if the command exists. - Window closes immediately. This can happen if a command finishes instantly or if there is a startup error. Try opening Command Prompt from the Start menu search instead of a shortcut, or run
cmd /kto keep the window open after a command. - System commands fail or hang. Run
sfc /scannowas administrator to check for corrupted system files. If problems persist, consider a system restore or reset, but back up your data first—a reset can remove installed programs and files.
If none of these steps work, check the official Microsoft support pages for Command Prompt or contact Microsoft support. Avoid downloading “fix-it” tools from unknown sources.
Frequently Asked Questions
Is Command Prompt the same as PowerShell?
No. They are separate command-line tools. Command Prompt uses the older command syntax, while PowerShell is more advanced and supports scripting. Some commands work in both, but many do not.
Can I use Command Prompt without administrator rights?
Yes, you can open and use a standard Command Prompt for many tasks. However, commands that change system settings or access protected files require administrator rights.
How do I copy text from Command Prompt?
Right-click the window title bar, choose Edit > Mark, select the text with your mouse, and press Enter. Alternatively, enable “Use Ctrl+Shift+C/V as Copy/Paste” in the window properties (right-click the title bar > Properties > Options).
Why does my Command Prompt show a different folder than expected?
Command Prompt opens in your user folder by default. If you opened it from a shortcut or another location, it may start elsewhere. Use cd to navigate to the folder you need.
Can I run Command Prompt commands from a script?
Yes. You can save commands in a .bat or .cmd file and run it by double-clicking or from Command Prompt. Be cautious with scripts from unknown sources.
What should I do if a command is stuck?
Press Ctrl+C to cancel the current command. If that does not work, close the window. Note that closing the window stops the command and may leave partial changes.