Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Windows 7 64bit installed on a virtual box (the fact it is a virtual box shouldn't be relevant). I need to overwrite /Windows/System32/d3d9.dll but the system won't let me.

I've read the same "solution" on a lot of forums, except nobody mentions it doesn't work at all:

takeown -f filename
cacls filename /G username:F

which both succeed. But then, when I try to delete the file, I still get access denied. And I am doing all this in safe mode AND within CMD being run as administrator.

What is the working way to delete the file so I can replace it? (or directly overwrite it)

share|improve this question
up vote 4 down vote accepted

The only sure way to delete/replace the file that is used by a running system is to do it from outside of it. E.g. boot off Windows 7 Install CD in Recovery Mode, open command prompt and proceed with the commands you quoted in your question. The DLL won't be in use, and you'll be able to delete it.

share|improve this answer

Because you are running in a Virtual Box environment it is very relevant because you can power down the VM, mount the underlying virtual harddrive in Windows 7 disk management and then replace the file you need as you would any other file.

share|improve this answer
Do you mean mounting the virtual harddrive on the host? I forgot to mention my host is Ubuntu linux. Is there a way I can mount the virtual drive on ubuntu and delete files inside it? What is Windows 7 disk management? – matteo Jan 11 '12 at 0:06
I don't know how to mount the virtual harddisk under Ubuntu. Windows 7 Disk Management is one of the system tools that lets you manage disks. A feature that was added in Windows Vista and above is to mount VHDs as a standard drive (new drive letter effectively). If I had known what your host OS was I would not have mentioned mounting the disk since I can not tell you how. Jaimg's answer is the better solution for you here. – Top__Hat Jan 11 '12 at 14:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.