Windows 10: Why does Windows return access denied when trying to touch a file being deleted

Discus and support Why does Windows return access denied when trying to touch a file being deleted in Windows 10 Software and Apps to solve the problem; Apologies if the topic has already been beaten to death but I couldn't find a discussion.Trying to access a file with WCreateFile or WGetFileAttributes... Discussion in 'Windows 10 Software and Apps' started by Jeffrey_i, Jan 20, 2022.

  1. Jeffrey_i Win User

    Why does Windows return access denied when trying to touch a file being deleted


    Apologies if the topic has already been beaten to death but I couldn't find a discussion.Trying to access a file with WCreateFile or WGetFileAttributes while the file is the target of a WDeleteFile call results in ERROR_ACCESS_DENIED 5 from GetLastError. The NTSTATUS error code from RtlGetLastNtStatus is STATUS_DELETE_PENDING 0xC0000056.My issues are:1. Why doesn't GetLastError return ERROR_DELETE_PENDING 303 rather than ERROR_ACCESS_DENIED? Clearly somewhere in the code the cause of the trouble is known and GetLastError has an error code for this situation so why isn't it used?2.

    :)
     
    Jeffrey_i, Jan 20, 2022
    #1
  2. Polterry Win User

    Denied Access to delete files

    Thanks for suggestions. I tried AVG Remover but it found nothing; probably because I had already deleted the bulk of the files. I also tried Command and Safe Mode but both gave Denied message. So the question remains how do I get access to delete files? Would changing to MS login at Start help?
     
    Polterry, Jan 20, 2022
    #2
  3. AJWtechit Win User
    Recycle Bin - Deleting an item returning 'Folder Access Denied'

    Hi,

    I am trying to delete a file from one of my user's PC's and I keep getting the below message returned:


    Why does Windows return access denied when trying to touch a file being deleted [​IMG]


    I have referenced this thread already -> Recycle Bin Corrupted - Cannot Delete File or Folder

    Method 1 returns no results - when I actually navigate to c:\$recycle.bin it shows as empty, and there are no other drives I cannot locate the file in (show hidden files is selected)
    Method 2 - I cannot see the hidden $recycle.bin folder in the C drive with hidden files ticked on.

    What I have tried:
    - I have tried running the recycle bin as an administrator
    - Tried running cmd as admin to clear the recycle bin
    - Tried running CCleaner to clear the recycle bin
    - Tried restoring the file in question (won't restore)

    Anyone have any other suggestions?

    Thankyou!
     
    AJWtechit, Jan 20, 2022
    #3
  4. Bree Win User

    Why does Windows return access denied when trying to touch a file being deleted

    [Question] Delete files with denied access with batch scripts

    'Access denied' may be because the file is open. Another cause of 'access denied' can be ownership and/or permissions. If it is permissions, try running the script as administrator.

    By the way, you don't put a space between the '/' and the option letter, and the /A option on its own like that does nothing. It is for selecting files by attribute and should be followed by a colon and list of attributes, eg. /A:RSH

    The SYSTAG.BIN file is usually created by Aomei Backupper and that may have the file open.

    what is systag.bin? — AOMEI Forum
     
Thema:

Why does Windows return access denied when trying to touch a file being deleted

Loading...
  1. Why does Windows return access denied when trying to touch a file being deleted - Similar Threads - Why does return

  2. Why I am being denied access to CMD?

    in Windows 10 Software and Apps
    Why I am being denied access to CMD?: It keeps saying I must log-in an admin. I am already logged-in as an admin. https://answers.microsoft.com/en-us/windows/forum/all/why-i-am-being-denied-access-to-cmd/ec75d7ae-113b-4bc8-a305-334b5295e96d
  3. Why I am being denied access to CMD?

    in Windows 10 BSOD Crashes and Debugging
    Why I am being denied access to CMD?: It keeps saying I must log-in an admin. I am already logged-in as an admin. https://answers.microsoft.com/en-us/windows/forum/all/why-i-am-being-denied-access-to-cmd/ec75d7ae-113b-4bc8-a305-334b5295e96d
  4. Why does Windows return access denied when trying to touch a file being deleted

    in Windows 10 Network and Sharing
    Why does Windows return access denied when trying to touch a file being deleted: Apologies if the topic has already been beaten to death but I couldn't find a discussion.Trying to access a file with WCreateFile or WGetFileAttributes while the file is the target of a WDeleteFile call results in ERROR_ACCESS_DENIED 5 from GetLastError. The NTSTATUS error...
  5. Why does Windows return access denied when trying to touch a file being deleted

    in Windows 10 Gaming
    Why does Windows return access denied when trying to touch a file being deleted: Apologies if the topic has already been beaten to death but I couldn't find a discussion.Trying to access a file with WCreateFile or WGetFileAttributes while the file is the target of a WDeleteFile call results in ERROR_ACCESS_DENIED 5 from GetLastError. The NTSTATUS error...
  6. Access is Denied when trying to delete, rename, or move folder that shows as "File Folder...

    in Windows 10 Network and Sharing
    Access is Denied when trying to delete, rename, or move folder that shows as "File Folder...: Hello all, I'm having quite the issue over the last few days. I'm trying to test migration of on-premise storage replication to OneDrive, and while trying to move documents from the network share to my local Documents folder, a folder is giving me problems. Digging deeper,...
  7. Access denied when force deleting a file

    in Windows 10 Network and Sharing
    Access denied when force deleting a file: The previous owner of my windows 10 laptop fell for a scam? involving a free burning studio from disc-maker.net. The program causes a pop-up to be on my screen all the time, and the pop up won't go away. I traced the file down and attempted to delete it, but since it's...
  8. Deleting files/folders access denied

    in Windows 10 Support
    Deleting files/folders access denied: Ok I have a flash drive connected to my network directly inserted into my router. After much research and toying with the settings I finally got it to show up in Windows File Explorer and it appears under "THIS PC" as one of my drives on the "NETWORK" and when I view...
  9. Denied Access to delete files

    in Windows 10 Support
    Denied Access to delete files: I am experiencing the infamous Blue Screen irregularly and I suspect from reading posts it is linked to AVG Internet Security product. I bought this but later canceled it and thought I had uninstalled it. However later I found that the uninstallation left a lot, if not all,...
  10. Recycle Bin - Deleting an item returning 'Folder Access Denied'

    in Windows 10 Support
    Recycle Bin - Deleting an item returning 'Folder Access Denied': Hi, I am trying to delete a file from one of my user's PC's and I keep getting the below message returned: [img] I have referenced this thread already -> Recycle Bin Corrupted - Cannot Delete File or Folder Method 1 returns no results - when I actually navigate...