I'm going to delete 1.mp3 but it gives me the error "Access is denied".
More info about file's perms:
attrib 1.mp3
A C:\Users\Alipour\Desktop\1\1.mp3
I also used attrib -s -h 1.mp3
but still it can not be deleted by
del /f/s/q 1.mp3 > NUL
or
del /f/s/q 1.mp3
or
del /f 1.mp3
Right-click the file or folder, and then click Properties. Click the Security tab. Under Group or user names, click your name to see the permissions that you have. Click Edit, click your name, select the check boxes for the permissions that you must have, and then click OK.
There are several methods to remove such a file:
1. Process Explorer if the file is in use:
You can use ProcessExplorer from Windows Sysinternals to identifiy which program locks the file. Download and start ProcessExplorer and go to Find|Find Handle or DLL... Ctrl+F
and enter the name of the locked file: 1.mp3
.
ProcessExplorer will show you the process that is responsible for the lock because of accessing the file. If you've got the proccess kill that one and delete the file.
Example with MS Word accessing a file called LockedFile.docx:
2. Safe mode boot:
Another possibility is to boot into safe mode. In pre Windows 8 era this was done by pressing F8 before Windows boots.
In Windows 8 and higher you can press Shift+F8 before Windows boots or more easily you can hold Shift and click Restart in the login screen or even in Windows. If this was too short, look here how to get into safe mode.
Once you're in the safe mode you can try again deleting that file.
3. Remove file on Windows boot via PendingFileRenameOperations:
With PendingFileRenameOperations you can rename and even delete a file on Windows boot procedure when nothing else can access and block that file.
PendingFileRenameOperations will be entered in the Windows registry and consists of pairs of file paths.
You can do it manually as described below or again with a Windows Sysinternals program called MoveFile. Download that program and use it in a console window (Start -> Run or Windows-Key+R, type cmd
and press ENTER).
Type movefile foo.exe ""
to delete a file on reboot.
Manual method via registry:
The 1st path is the file to be renamed.
The 2nd path is the new file path.
If the 2nd path is empty (0x0000) the file get's removed.
regedit
, and press ENTER
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager
PendingFileRenameOperations
\??\filepath
as the data (e.g. \??\C:\Users\xyz\Desktop\foo.exe
)0000
(4 zeros which represent an empty string)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With