Windows File Access Denied

file-permissionswindows 7

I seem to have a general problem with "access denied on Windows". It manifests itself every time if e.g:

  • My bat file calls a compiler creates a file on disk
  • My bat file renames a file
  • But I also have files downloaded (FireFox) to Windows desktop where Windows is giving me "access denied" if I try delete the file.
  • Tried disable AVG + make exception in AVG resident shield

(I have tried checking with Task Manager + Winternals process explorer that it is not process running still running that should cause the locks.)

  • Windows 7.
  • My user account is an administrator.
  • All files are created by same user account.

The problem is recent, but some things I first noticed yesterday
(when I started calling .bat files again which I have used for many years)

I have tried:

  • Starting e.g. Windows Explorer with "run as administrator", but that makes no difference
  • right-click – properties – security and changes permissions/ownership (I also get "access denied" when trying this so this does not help)

Here is a ascreenshot if I try change security of a "locked" file. (The problem here is the locking occurs continously every time the file is created)

!exampel

If I click onwards, it states I am not the owner?
Instead I see this: "Unable to display current owner"

If I try to change ownership, I get "access denied" (don't have rights)

Which baffles me as I just created it. (Yes, through a .bat file calling executables that create the file. But all running under my administrator user account.)

I think this is some kind of weird issue of something somewhere holding file handles for some time after file has been attempted deleted by .bat file…

I have tried to walk away 5 minutes after the .bat file has issue the delete instruction. (Pausing .bat script) When returning (after minutes) the file is gone. (This took some time for me to notice since it was by accident I discovered this, but it seems I can repeat it)

So the reason for all the problems may be the file somehow is in a kind mysterious state where the file has been scheduled for deletion, but it just goes extremely slow? (And hence all other operations performed on the file also behaves very oddly.)

I have no idea why this is (have tried disabling e.g. AVG), but I guess it could explain the sudden problems?

Best Answer

Use Unlocker to unlock those files and then try to do whatever you want. Unlocker does natively support deletion, renaming etc, too.

[Optional] I'd also like to suggest you to scan computer for threats using Norton Power Eraser (Its free, portable; it can work along with AVG, too) if you don't exactly know whats causing the problem.

Related Question