Quantcast
Channel: Active questions tagged windows - Super User
Viewing all articles
Browse latest Browse all 9746

Access denied when using Remove-Item even with -Force because file is in use

$
0
0

I am using PowerShell to delete all files from a folder.

Remove-Item C:\ProgramData\Microsoft\SF\Log\Traces\* -Force

Problem is it throws Access is denied error because there is one file (the latest one generated by the process) being used by some process.

If I try to delete that particular file using Delete button on keyword then I get same error. But if I use Shift + Delete then I am able to delete file successfully.

Even if I run PowerShell as Administrator, I get same error.

How do I tell PowerShell to Shift + Delete file?


Viewing all articles
Browse latest Browse all 9746

Trending Articles