Kriti
Kriti

Reputation: 191

Access denied when trying to delete a folder on Window VM

This is a strange problem I am facing today. Yesterday, I logged into Windows VM and tried running a simple batch script which deletes an exe if it exists.

     IF Exist "C:\Temp\installer.exe" del installer.exe

It worked fine yesterday. Today, I came and logged in as same user and tried executing this batch script, it says "Access is denied." I tried with most of the switches like /f, /Q but of no use. And moreover when I tried deleting it manually, it required admin rights today. But yesterday, I could delete the same exe 100 of times using that simple script. Could anyone explain this strange behavior and the solution to this.

Thanks. Kriti

Upvotes: 0

Views: 1648

Answers (2)

foxidrive
foxidrive

Reputation: 41234

I suspect you mistakenly launched the executable and it was running - hence the 'access denied'.

Upvotes: 0

Matthijs
Matthijs

Reputation: 1142

I know a solution that often works: take ownership

I don't know how this happens but this might solve your problem for now!

Upvotes: 1

Related Questions