However, sometimes while running such programs or modifying/deleting a file/folder with this tool, you may encounter the “Access is denied” error message. It may show an error code or tell you the reason for the issue, but usually, it doesn’t provide additional information.In this article, we have listed all possible causes for the issue along with their corresponding solutions.
Causes for Command Prompt Access Denied
How to Fix Command Prompt Access Denied?
Below mentioned are the possible solutions to resolve the access error on Command Prompt:
Lack of admin privilege.Misconfigured permissions.Encryption of folders and files.Malware infection.Restriction due to third-party security software.
Open Command Prompt as Admin
While the usual Command Prompt is enough for most purposes, you can’t run certain looks, like SFC, DISM, etc., using the program. To do so, you need to run Command Prompt as admin, which elevates its permission level.You can use either of these methods to open Command Prompt as admin:
Open Run by pressing Win + R, type cmd, and press Ctrl + Shift + Enter.Search for cmd or command prompt on the search bar (Win + S), right-click on it, and select Run as administrator.(In Windows 11) Press Win + X, select Windows Terminal (Admin), and press Ctrl + Shift + 2.
Look for and Close the Program Locking the File
You won’t be able to modify or delete files that some other program is using at that moment. If you try doing so, you’ll get the above error message. You can usually close the program by searching for it on the Task Manager or Process Explorer to resolve this issue.If you know which process or app is responsible, you can use Task Manager.If you don’t know the process, it’s better to use Process Explorer.However, there may be other possible reasons for the file to be locked. We recommend you refer to our article, File is Open in Another Program to find the necessary solutions for all cases of this issue.
Change Permissions of Current Working Directory (CWD)
Windows uses the NTFS partition, which includes two different types of permissions. One of those is the Access Control List (ACL) which specifies users and groups permissions for a folder/file.You can also experience this error if you don’t have ownership of the current working directory (the directory you see before the ‘>’ sign) or the file, as well as ACL permissions to read/write inside the directory. It can even happen for system folders like System32 if a malware changes the ACL permissions.Here’s how you can manually change these permissions and resolve the issue:You can also use the Command line for this purpose if you find it daunting to navigate the graphical interface. To do so,
Scan with Antivirus
As we mentioned earlier, some malware scripts can modify the ACL permissions of your files and folders, leading to this error. You can resolve the issue by manually changing the permissions. However, you also need to detect and remove the malware to prevent such issues from occurring again. To do so,
Remove Encryption
If a file is encrypted, you won’t be able to access it if you don’t have the necessary certificate keys stored on your user account. In such cases, trying to move or modify the file through the Command Prompt displays “Access is denied.” You need to remove the encryption to perform those tasks. To do so,
Check File Corruption
It is also possible that your files or folders are corrupted, and your system is protecting itself by denying access. If your CWD is a system directory, you can run the System File Checker (SFC) and Deployment Image Servicing and Management (DISM) to repair such corruption. To do so,
Uninstall Third-Party Security Software
It is also possible that some security software like a personal firewall or antivirus is blocking access to a third-party executable file. In such a situation, you will get the Access denied error while trying to run this program.First, ensure the file is not harmful in any way. Then, you can temporarily disable your third-party firewall or antivirus before using the Command Prompt to run the file. After you are done, don’t forget to re-enable your security apps.
Clean Install OS
If you are unable to resolve the issue after performing all these steps, your only remaining option is to make a clean install of Windows. Below mentioned are the steps to do so. However, depending on your Windows version, there might be a few minor differences.