'Command prompt not opening in windows 10

I am trying to open the command prompt but if I open it just opens for a second then gets closed. I also use the command prompt for vscode and I am not able to open the terminal in vscode as well. I tried restarting my computer several times but still, the command prompt doesn't open.

Please suggest a solution from which I can open my command prompt

cmd


Solution 1:[1]

I did have the same problem. The following method worked for me.

Open Powershell (Admin) and enter:

echo off
reg delete "HKCU\Console" /f
reg delete "HKCU\Software\Microsoft\Command Processor" /v "AutoRun" /f
reg delete "HKLM\Software\Microsoft\Command Processor" /v "AutoRun" /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File 
Execution Options\cmd.exe" /f
echo done

Found this on a comment from Mr. Holman Calda in this video How to Fix Command Prompt(CMD) Not Working/Opening in Windows 10.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nicolás Muñoz