cmd.exe is not in the directory C:\Windows\System32. I think that I accidentally deleted it while messing with the environment variables, I don't know.
It's not launching from PowerShell, and I also tried Run (Win + R), but it still doesn't work.
I think reinstalling Windows is an option, but I don't know what can happen.
I'm using Windows 10.
How can I recover/restore cmd.exe?
3 Answers
You can run the System File Checker tool (SFC.exe) which will repair missing or corrupted system files:
- Open PowerShell as administrator.
- Enter
sfc /scannow.
From Microsoft:
0The
sfc /scannowcommand will scan all protected system files, and replace corrupted files with a cached copy that is located in a compressed folder at %WinDir%\System32\dllcache. The %WinDir% placeholder represents the Windows operating system folder. For example, C:\Windows.
If it was not deleted too long ago, you can retrieve it from a windows restore snapshot. Open Explorer, go to the properties of the folder C:\Windows\System32 (via the right-click menu), and go to "Previous Versions", from which you can open any snapshot of that folder. Snapshots that were taken before a file was deleted would contain that file.
2As requested in the comments, I'm posting this as an answer:
There's a website called Winbindex that provides links for Windows 10 binaries. The links are to Microsoft servers, so you don't need to trust a third party service as long as you verify that the links lead to Microsoft servers (if you don't know what that means, I don't recommend to use the service).
For example, here are various cmd.exe versions to download:
All links lead to msdl.microsoft.com, for example:
9