In the early days of computing, the command prompt reigned over operating systems before elegant graphical user interfaces became the primary mode of interacting with computers. Today, the command prompt is mainly used by advanced users to troubleshoot specific Windows problems, perform administrative functions, and automate tasks via scripts and batch files.
What should you do when you try to open the command prompt and it throws an error instead of opening as usual? This is the topic of today's guide. Let's take a look at some steps that can fix the command prompt not working error, so that you can get back to using and running those commands.
1. Check the antivirus
Some antivirus software has been known to cause problems with the command prompt. One such antivirus is Avast. The consent.exe file is known to be quarantined causing the command prompt to crash. If you are using Avast, repair this file or search for an alternative antivirus.
If you are using another antivirus, I recommend that you disable it once to see if it fixes the command prompt error not working in your Windows 10 computer.
2. Command Prompt shortcut
The Start menu may not work as expected. If so, you can create a command prompt shortcut on your desktop to start the same. To do this, right-click anywhere on the desktop and select Shortcut under New.
- In the pop-up window, type cmd.exe (you do not need to navigate to the location of the executable file) in the box, then click Next.
- Give it a suitable name and click Done. Wait, there's more to take care of.
- That shortcut will launch the command prompt but not in administrator mode. For this, right-click on the newly created shortcut and select Properties.
- On the Link tab, select Advanced.
- Select Run as administrator here, click OK and that's it.
Try starting the command prompt now.
3. Create new user
Command Prompt requires administrator rights, which means that the user account you are logged in with requires administrator privileges. If you do, maybe some files have been damaged causing the command prompt error. Let's create a new user account to test this solution.
- Press the Windows key + I keyboard shortcut to launch Settings and select Accounts.
- In Family & other users, select Add someone else to this PC.
- Click "I don't have this person's login information" here.
- Now click "Add a user without a Microsoft account".
- Enter your desired username and password here and follow the on-screen instructions to create a new user account. Once done, switch user accounts by pressing the Windows key to launch the Start menu and selecting the newly created user account under your current account.
Check if you can run Command Prompt now.
4. Update path of system environment variables
Microsoft support staff recommend doing this when the Windows Command Prompt doesn't open, so we think it's working fine. Type system environment variables in the Start menu search and select the Edit option.
- On the Advanced tab, select Environment Variables.
- Select Path here and click Edit.
- Click New and add it to create a new path: C: WindowsSysWow64
Now restart your computer and check if you can start the command prompt.
5. System File Checker (SFC)
Open PowerShell with administrator rights by searching for it in the Windows Start menu or by right-clicking the Windows button. When it opens (blue background), you will run the following command.
Suggestion advanced: PowerShell is the most advanced version of Command Prompt and you can run all CMD commands on PowerShell.
Next, the SFC command will check for irregularities in the system files of the operating system and repair them if necessary. This may take 15-20 minutes, so sit back and relax. If it doesn't find any errors, you'll see a message that says something like "no integrity violations found". If some corrupt files have been found and repaired, a message will pop up informing you that “the damaged files have been repaired” and “the details are included in a CBS.log file” with the file path also mentioned.
If the files get repaired, I suggest you restart your computer before trying to open the command prompt.
Sometimes, the SFC command fails to do its job because it cannot find or access the correct files from the Windows image. This is where you will run the Deployment Image Servicing and Management (DISM) command and run the SFC command again.
Open PowerShell again and run the following commands in that order one at a time.
DISM / Online / Cleanup Image / CheckHealth
DISM / Online / Cleanup Image / ScanHealth
DISM / Online / Cleanup Image / RestoreHealth
Now go back to step 5 above and run an SFC scan.
7. Remove the context menu items
When you install a new app or software, it adds a shortcut to the context menu. The context menu opens when you right-click on the desktop or within an app. Did you notice some new options that weren't there when you first started using Windows? To remove these context menu items, download ShellMenuView and ShellExView. I recommend that you make a backup at this point.
First, launch ShellMenuView and under Menu Name you will see all the context menu links of the software and apps that were not created by Microsoft. For example, PotPlayer is a third party app while Microsoft developed Windows Media Player. Select all non-Microsoft context menu shortcuts and disable it by clicking on the red icon. Repeat the same process with ShellExView.
- Download ShellMenuView
- Download ShellExView
8. Safe mode
Maybe a recently installed app is causing problems with Command Prompt not opening? To find out, restart in safe mode. To do this, hold down the Shift key on your keyboard and select Restart under the power options in the Start menu.
Your PC will now restart and you should see a blue screen with some options. Select Troubleshoot> Advanced Options> Startup Settings> Restart. Now you can choose to restart in safe mode. Read more about the process here.
If Command Prompt works in Safe Mode, you need to uninstall all recently installed apps and reinstall them one at a time to see which app stops Command Prompt. I know it's a tedious process, but you have no other choice.
9. System Restore
When the command prompt does not start in Windows 10, you can restore your computer to an earlier point in time, and by doing so, you will restore balance to your universe or your PC. Please note that your files and other data will not be deleted. This could eliminate and undo anything that broke the command prompt. To do this, search for Repair in the Windows Start menu and select Recovery.
- Select Open System Restore.
- You should now see all the recently created system restore points.
- Click Show More Restore Points to reveal more options.
- Select one and follow the onscreen instructions to reset your PC.
The process will take some time and the system may reboot multiple times.
While you can use PowerShell to run any command you want to use in the command prompt, it's still a good idea to fix the first one as it may cause further problems in the future. If you've found another way to troubleshoot command prompt issues, let us know in the comments below.
- How to copy and paste in PuTTY
- How to open command prompt
- Windows 10 stuck on automatic recovery, 6 solutions
- Command Prompt: what it is and how to use it
- How to check if Windows 10 is activated