What should you do when you try to open the Command Prompt, and it throws an error instead of opening usually? That is the topic of today's guide. Let's take a look at some steps that can solve the Command Prompt not working error so you can go back and execute those commands.
Fun Fact: Command Prompt has a symbol at the beginning of the line that prompts the user for a command, indicating that it is ready for input and hence the name Command Prompt.
1. Check Antivirus
Some antivirus software are known to cause problems with Command Prompt. One such antivirus is Avast. It is known to place the consent.exe file in quarantine causing the Command Prompt to crash. If you are using Avast, restore this file or look for an alternative antivirus.
If you are using some other antivirus, I would recommend disabling it once to see if it solves the Command Prompt not working error in your Windows 10 computer.
2. Command Prompt Shortcut
It is possible that the Start Menu is not working as intended. In that case, you can create a Command Prompt shortcut on your desktop to launch the same. To do so, right-click anywhere on your desktop and select Shortcut under New.
On the pop-up window, type cmd.exe (no need to browse to the location of the executable file) in the box, and then click on Next.
Give it a suitable name and click on Finish. Wait, there's some more to take care of.
That shortcut will launch the Command Prompt but not in administrator mode. For that, right-click on the newly created shortcut and select Properties.
Under the Shortcut tab, select Advanced.
Select Run as administrator here, click on OK, and you are done.
Try launching the Command Prompt now.
Note: This solution isn't suitable for shared computers for some users might end up messing with the system accidentally if they aren't sure what they're doing.
3. Create New User
The Command Prompt needs admin rights which means the user account that you've logged in with requires administrative privileges. If you do, maybe some files got corrupted resulting in the Command Prompt error. Let’s create a new user account to test this solution.
Press the Windows key+I shortcut on the keyboard to launch Settings and select Accounts.
Under Family & other users, select Add someone else to this PC.
Click on 'I don't have this person's sign-in information' here.
Now click on 'Add a user without a Microsoft account.'
Enter the desired username and password here and follow the on-screen instructions to create a new user account. Once done, switch user account 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 the Command Prompt now.
Also on Guiding Tech
4. Update Path of System Environment Variables
The Microsoft support staff recommends this so we figure it would work aptly. Type system environment variables in the Start Menu search and select the Edit option.
Under the Advanced tab, select Environment Variables.
Select Path here and click on Edit.
Click on New and add this to create a new path.
Now reboot your computer and check if you can launch the Command Prompt.
5. System File Checker (SFC)
Open PowerShell with admin rights by either searching for it in Windows Start Menu or right-clicking the Windows button. When it opens (blue background), you will execute the below command.
Pro Tip: PowerShell is the more advanced version of Command Prompt, and you can execute all CMD commands on PowerShell.
After that, SFC command will check for irregularities in your OS's system files and repair them, if necessary. It may take 15-20 minutes so sit back and relax. If it finds no errors, you will see a message that says something like ‘no integrity violations were found.’ If some corrupt files were found and repaired, you would see a message telling you that ‘corrupt files were repaired’ and ‘details are included in a CBS.log file’ with the path to the file also mentioned.
If files are repaired, I suggest you reboot your computer before trying to open the Command Prompt.
Sometimes, the SFC command fails to perform its duty because it fails to find or access the correct files from the Windows image. That is when you will run the DISM (Deployment Image Servicing and Management) command and re-run the SFC command again.
Open PowerShell again and run the below 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 point 5 above and perform an SFC scan.
Also on Guiding Tech
7. Remove Context Menu Items
When you install a new app or software, it adds a shortcut to the context menu. The context menu pops up when you right-click on your desktop or within an app. Noticed some new options that were not there when you first started using Windows? To remove these context menu items, download ShellMenuView and ShellExView. I recommend you to take a backup at this point.
First, launch ShellMenuView, and under Menu Name, you will see all software and app context menu shortcuts 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 them by clicking on the red icon. Repeat the same process with ShellExView.
Maybe a recently installed app is causing a conflict with the Command Prompt? To find out, reboot in Safe Mode. To do so, press and hold the Shift key on your keyboard and select Restart under the Power options in the Start Menu.
You PC will now reboot and you should see a blue screen with some options. Select Troubleshoot>Advanced options>Startup Settings>Restart. You can now choose to reboot into Safe Mode. Read more about the process here.
If the Command Prompt works in Safe Mode, you need to uninstall all recently installed apps and reinstall them one at a time to see which one breaks Command Prompt. I know it's a tedious process, but you have no choice.
9. System Restore
You can restore your computer to a previous point in time, and by doing so, you will restore balance to your universe or your PC. Note that your files and other data will not be deleted. That may eliminate and undo whatever broke the Command Prompt. To do so, search for Restore in Windows Start Menu and select Recovery.
Select Open system Restore.
You should now see all the system restore points made recently. Click on Show more restore points to reveal more options.
Select one and follow on-screen instructions to restore your PC. The process will take quite a while, and your system may reboot several times.
Your Wish is My Command
While you can use PowerShell to execute any command that you wanted to use in Command Prompt, it is still a good idea to fix the former because it may cause further trouble in the future. If you found another way to fix the Command Prompt, do let us know in the comments below.
Next up: Fed up of the good old Command Prompt and even PowerShell? Here are three CMD alternatives that will make you forget these two.