I was following an online tutorial and searched for msvcp140.dll in the System32 folder. The search returned several files with the same name, and I accidentally moved the wrong one without noticing which folder it came from. I moved it instead of deleting it because I thought that would be safer, but now I can't use Ctrl+Z to undo the change. The computer is still working normally, but I'm worried the missing DLL could cause problems later. Where is msvcp140.dll normally located, and what is the safest way to restore it?
3 Answers
That DLL can exist in several locations, including copies stored in the Windows Driver Store. The important copy is normally in the main System32 directory. The safest fix is to reinstall or repair the Microsoft Visual C++ Redistributable package for Visual Studio 2015–2022 using the official Microsoft installer. You generally don’t need to manually move DLL files around.
Moving a file can usually be undone with Ctrl+Z too, not just deleting one. If that no longer works, reinstalling the current Microsoft Visual C++ Redistributable should restore the required files. The Driver Store may contain additional copies used for rollback, and its exact contents vary between computers.
If Windows starts showing system-file errors, you can also repair the Windows image from an elevated PowerShell or Command Prompt. The standard repair command is `DISM /Online /Cleanup-Image /RestoreHealth`, followed by `sfc /scannow` if needed. Since the computer is currently functioning, reinstalling the Visual C++ package is the most direct first step.

I tried using Ctrl+Z, but it didn’t restore the file. I’ll try repairing the Visual C++ installation instead.