How can I restore Cmd.exe (Command Prompt) if it doesn't exist?

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?

8

3 Answers

You can run the System File Checker tool (SFC.exe) which will repair missing or corrupted system files:

  1. Open PowerShell as administrator.
  2. Enter sfc /scannow.

From Microsoft:

The sfc /scannow command 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.

0

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.

2

As 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like