Cmd crashes with exit code 1 after uninstalling anaconda

Viewed 8886

Problem description

I got this problem in my Win10 Pro Machine. I uninstalled Anaconda because it gaves me problem with Jupyter notebook and reinstalled it. But since then I'm unable to access Command Prompt.

As soon as I open it it closes. I figure it out opening VSCode and reading Cmd has exited with error code 1. And now nor Anaconda Prompt is starting up, but as soon as I open PowerShell it's says (conda) so I think it works from there.

powershell and cmd /d

From Powershell if i type in cmd and it exit immediately without complaining about anything. But if I type cmd /d it works.

Tried fix that didn't work

  • Removing Anaconda from path
  • I read somewhere here that it may be caused by some kind of bad command on cmd startup and in fact with cmd /d works as usual.
  • I tried to follow the registry fix about startup commands for cmd but the registry entry was missing in my case maybe this could be the issue
  • Neither sfc /scannow nor DISM.exe /Online /Cleanup-image /Scanhealth worked

Infomation i found online

According to this website ErrorCode 1 'Indicates that Action has attempted to execute non-recognized command in Windows command prompt cmd.exe'.

Actual request

Can anyone help me with this issue please? I tried to look online for a week but with no luck, thank you for your time

5 Answers

The following answer was (supposedly) initially posted (but later removed) by @Mofi and I got it from the comment of @filippo-vicari. So all credits go to them, thanks for solving this issue! It took me hours to finally find their solution.

Enter the following command into the still working powershell (in my case Anaconda Powershell):

C:\Windows\System32\reg.exe DELETE "HKCU\Software\Microsoft\Command Processor" /v AutoRun /f

It worked for me immediately. cmd.exe and Anaconda Prompt now work flawlessly again!

I had the same problem after completely uninstalling anaconda (without reinstalling it). I was able to fix it by going to "Computer\HKEY_CURRENT_USER\Software\Microsoft\Command Processor" in the registry editor and deleting the AutoRun key.

If somebody (like me) still having problems like 'Code: 1' and shell says 'cmd.exe is not a command', just add C:\Windows\system32 to the PATH

Not only a location af HKCU. These should be deleted too:

HKLM\Software\Microsoft\Command Processor

Add the following value to the system variable Path:

 C:\Windows\system32 
Related