Today I was helping a Microsoft Windows 10 user that couldn’t read or write to files in a folder on the network. I figured something was set on the files that had them set to Read Only. So I ran the following DOS command on the folder containing the files:
attrib *.* -r +a -s -h /s
Some of the files were changed fine, but others threw an access denied error message. There are a few things to check when this happens. We’ll cover the most common in this guide.
1. Be Sure You are Running the Command With Admin Rights
- Click “Start“, then type “CMD“.
- Right-click on “Command Prompt“, then choose “Run as Administrator“. This will give you proper rights.
- Type the attrib command
2. Check if File is in Use
Are any of the files in use by a program or open on another computer that is connected? Ensure nothing has access to the file when trying to run attrib. If you can’t track down if the file is in use, you may want to try starting the computer in Safe Mode.
3. Check Permissions
Do you have access to all of the files you are running attrib on? You can check this with these steps:
- Right-click the folder you’re working with then select “Properties“.
- Select “Security“.
- Select the “Edit…” button to edit permissions.
- Select “Add…“.
- Type your username to allow just your account access, or type “EVERYONE” to allow access to anybody. Select “OK” when you’re ready.
- With the account you just added higlighted in the “Group or user names” area, select the “Allow” check for “Full control“. Select “OK” when you’re ready.
4. Check File System or Disk
It’s very common for attrib to throw “Access Denied” errors if there is problem with the hard drive. Try running
CHKDSK /F on the drive from a DOS command prompt, then try to run attrib again when it’s finished scanning.
Hopefully, a set of instructions above helped. Please feel free to share your experience in the comments section below.