Subscribe to How-To Geek

Recommended: Click Here to Run a Free Scan for Common PC Errors   [Sponsored Link]

How to Delete a System File in Windows Vista

Warning: Do not delete system files. Bad things will probably ensue.

If you need to delete or overwrite a system file in Windows Vista, you'll quickly notice that you cannot delete system files, even as administrator. This is because Windows Vista's system files are owned by the TrustedInstaller service by default, and Windows File Protection will keep them from being overwritten.

Thankfully, there's a way that you can get around this. You need to take ownership of the files, and then assign yourself rights to delete or modify the file. For this, we'll use the command line.

Open an administrator command prompt by typing cmd into the start menu search box, and hit the Ctrl+Shift+Enter key combination.

To take ownership of the file, you'll need to use the takeown command. Here's an example:

takeown /f C:\Windows\System32\en-US\winload.exe.mui

That will give you ownership of the file, but you still have no rights to delete it. Now you can run the cacls command to give yourself full control rights to the file:

cacls C:\Windows\System32\en-US\winload.exe.mui /G geek:F

Note that my username is geek, so you will substitute your username there.

At this point, you should be able to delete the file. If you still can't do so, you may need to reboot into Safe Mode and try it again. For the filename in the example, I was able to overwrite it without safe mode, but your mileage may vary.

The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 01/28/07 and tagged with: Windows Vista, System Administration

Comments (54)

  1. Rob K.

    Works Great Thx!!!

  2. Jmc15john

    This actually works and it's good because the onscreen keyboard was being gay and always turning on, on a boot up. Not anymore.

    Thanx

  3. joydeep

    Thanks for the tip for deleting system32 files. I almost got frustrated with the idea of having to install Vista for the 3rd time in a span of 6 hours… Thanks a lot. It works.

  4. Iwatson

    How do you delete a directory or several files? The reason I asked this is, I installed vista two time on my laptop. The first was in a small partition and the second in the larger one. Now I need to delete the windows and system files from the small partition to free up space

  5. Will

    Thanks for the tips I am trying to do the same as Iwatson. This works great:

    cacls "Program Files" /T /G Administrator:F

    cacls "Windows" /T /G Administrator:F

    cacls "Users" /T /G Administrator:F

  6. alan

    ok, this seemed complicated since i wanted to delete many system files from a previous Vista install on a secondary partition that i was cleaning up. i didn't want to reformat, so i tried delete and ran into this brick wall.

    the solution that i find much easier for multiple files is the following:
    (assuming you CAN use admin privs) 1)via folder properties go to your security tab.
    2) in the bottom half you have the permissions listed for users, click the Advanced button
    3) now go to the Owner tab, click Edit button (you will be asked for permision if UAC is at default)
    4) change owner to your account and be sure to check the 'Replace owner on subcontainers and objects' and click Apply button. this results in all files including system files being switched to your account as owner!
    5)now in the 'Advanced Security Settings for (your folder)' you need to edit the permissions: select your account (the one you just used to take ownership) and click Edit button.
    6) you now see the Permissions tab and you need to again select your user account. (ensure that the permission is Full Control) check the lower 'Replace all existing inheritable permissions…' box and click Apply.
    You are done! now you can close all the property stuff and just delete your folder. it may still ask for permission, but you now have the needed permissions to delete all contents of the folder.

    hope this solves the problem for anyone that needs to take care of multiple files, obviously it will work for a single file as well.

  7. Anders

    You rock. I've had issues with some documents from an earlier (Beta) version of Vista. I could not read them after I reinstalled with my Ultimate (64-bit) version due to file access restrictions that couldn't be fixed with the normal menu-based ownership dialogs.

    Thank you very much :)

  8. bobo

    you do rock! i've been having print spooler issues and needed to replace the localspl.dll file but could not do it by takeown alone, but adding the calcsc command, all is good and i'm a very happy man. thanks!

  9. John

    I couldn't get this to work at first because the command prompt told my i didn't have permission to give myself permission (or something like that). If this happens to you, right click the command prompt icon and select "Run as Administrator"

  10. Peter

    Great! :D Thanks alot!

  11. Alekhine

    Thanks for the tips.

  12. Teddy

    Thanks for the nice trick.
    I had a bootmgr file on the wrong hd, because I tried to boot after forgetting to connect the boot-hd while fixing something. After reconnecting the pc tried to boot from the wrong hd, wich had no os and a error occured. A rather stuborn problem, wich is now fixed.

    Teddy

  13. Alex hates Vista & Gate

    I will do anything for you. I have been browsing around forums after forums for answers, and TAKEOWN has to be the best.

  14. Peter Hickey

    Installed and, because it doesn't work in Vista, uninstalled Nero 7. Left with 4 dlls in Nero Backitup folder. Nothing I did, including all of the above, would allow me to delete them. Eventually removed all references to them in the Registry, rebooted, again logged on as Administrator and then was able to delete them.

    Because of backwards compatibilty problems, it looks like it's going to be a long time before I'd recommend anyone upgrading to Vista, especially from XP Pro.

    Thanks

    Peter

  15. mike

    Ok Guys…..I really screwed up.(that's what usually happens when you don't know what your doing) I was trying to gain access to my entire drive so I could delete temp files/temp internet files etc. So, after reading this post on how to delete system files I used this in the command prompt: [takeown / C:\ f ] afterwhich it said that my-acer had owership….Cool so far….I think. Then I used the cacls command: [cacls C:\ *.* /G my-acer:F] I was asked if I was sure & answered yes,hit return & it said the process was successful. Now I can't get many things to run at all & if I attempt to use the command line as an admin I get this:"c:\windows\system32\cmd.exe the parameter is incorrect". I get the same sort of message when I try & run other things. I have to also say that when I login to start windows my name is "ironhorse" & the name of the pc is "my-acer". A friend told me I need to give full rights to both of these names if I want to delete certain files as their considered administrators(both me of course). I haven't restarted the machine cause I know it will never restart so I'm trying to get this fixed through the command prompt. I tyred to roll back through system protection but can't get there either. Am I screwed or is this fixable. I really need the help Big Time,Mike

  16. DaiLaughing

    For deleting folders in Vista (I did the whole of Program Files):

    M:\>icacls "m:\program files" /grant martin:(D,WDAC) /t

    martin is my user name. This grants delete and write rights to all folders, files and sub-folders in Program Files. No need to bother with takeowner as this seems to replace both it and cacls.

    Thanks a LOT for the original tip geek. Very helpful as I had a lot of wasted space on an old system drive which I have started using as a slave.

  17. TYXL

    u can use
    "takeown /f C:\*"
    and
    "cacls C:\* /G USERNAME_HERE:F"

    so u only need to use the command once :)

  18. mike v

    At the command prompt this is what I see: C:\Users\user
    Anything I type brings this response: ERROR: Access is denied.
    This is what needs to be overcome "First". Sorry, I should have made that clear. Mike
    PS: Thanks for the tips regardless as I may be using these in the future.

  19. mike v

    As there is no appearent answer to this question, what I think I'll do
    is wipe the drive & reinstall a clean copy of vista and stay away of
    the command line in the future untill I gain more knowledge.
    Thanks to all for the suggestions. Mike

  20. DaiLaughing

    You don't need to! All the steps are above.

    Press the Start button. Negotiate to the command prompt but don't click on it. Instead right click on it and Run as Administrator. Now type this:

    M:\>icacls "m:\program files" /grant martin:(D,WDAC) /t

    replacing M:\ with your drive letter and martin with your own user name. If your user name has any spaces put it in quotes like the "program files" is here.

    In XP use cacls instead.

  21. dwlejuez

    Q: I have a big issue with a file that is stuck in my emule incoming file which is a movie that downloaded completely.I cannot play it so I decided to delete it.Bummer…..when I click on it my computer seems to freeze up.HOW do I delete this file in CMD running windows vista?????
    PLS a step by step explanation would be nice. THNX dwlejuez

  22. Karlo

    as a response to wills post i tryed that with a folder on my hdd called system volume information but it told me acces is denied???? i tryed every other option and this one has worked the best so far until it said acces is denied

    Anybody have any answers?

  23. Nefertari

    I purchased My computer and they mistakenly used My sister's name on the registration I believe (she did the buying for Me.) Anyway, now I have a user\Najee that doesn't seem to really exist except if I'm doing downloads or if I go to users folder when I access it from Computers in the Start menu. Funny thing is I'm the administrator but in the Computer\Os\User folder, I don't exist. Just public and Najee. How do I get My account listed in users? How do I get rid of Najee in the list(love her but don't want My files named with her name)? Once again I repeat, when I go to Manage User Accounts, Najee doesn't show up.

  24. Kyle G

    Just as an update to this, you can use the wonderful freeware program called "Unlocker", located here. Just right click the file in question, click the "Unlocker" option in the context menu, then highlight any programs using the file and click Unlock or Unlock All at the bottom of the window, you should then be able to delete the file.

    I used this program a lot with WinXP and an so happy to have just learned it was Vista compatible as well.

    You might need to go ahead and do the Take Ownership step above, I have the registry tweaks added that give me an option in the context menu for this and did that first.

  25. John

    rd /s deletes all files and subfolders regardless of permission. I use the rd with 4nt but the cmd rd should perform the same.

  26. Steven

    I tried deleting the file d3d8.dll.

    The TAKEOWN worked properly, but the cacls after pressing enter to get full control this is what it says : "No mapping between account names and security ID's was done."

  27. Jillian

    I was having trouble using these commands to delete programs such as Windows Mail and Windows Sidebar etc. Can anyone help me out with the path to these files? Thanks so much

  28. Alex Maluleke

    I was having a big trouble in using these commands to delete programs such as Windows Vista in my own computer. And i recieved help from this web site, my problem is now solved.Thanks and regards. From South Africa, Johannesburg

  29. Varga

    How to undo this process after I'm finished deleting?

  30. Gasper

    Hi I deleted W. Defender but how can I delete Icon in control panel?

  31. Doug

    HELP!!!!!!!
    I took control of my entire C: drive, and changed only one .dll in the system 32 folder. Now my computer is crazy, and doesn't have access to anything. I can't even run the system restore to undo what I did. How do I un-own what I took ownership of? Do I just do the same thing as above but say TrustedInstaller instead of my user name???

  32. OmegaWolf747

    I wouldn't delete the Sidebar and Windows Mail. Just disable the services if you don't want them.

  33. vikTHgod

    Wich dll did you change Doug?

  34. lynn

    how do i delete the file named AVG7QT.DAT in command prompt??
    i got that from AVG. i don't know how to use the command prompt. can you please help me!!!

  35. jordan

    Hi i dont really under stand how to do this as im only a kid.
    Could some one tell me the exsact code to delete all the windows sidebar files on vista thanks

  36. confused

    Somebody please help, the first part was a sucess but after i do the ''cacls C:\Windows\System32\en-US\winload.exe.mui /G geek:F'' part it says Cacles is now deprecated please use Icacls.. and this it has around 15 line of some next thing…

  37. eaybdb

    when i try and take ownership of the file, it comes up with the error bthat the file can't be found. anyway of deleting a .lnk shortcut when it isnt actually there!!

  38. The_Thrustmaster

    thanks for the tips im going to go home and try it…. but knowing vista it will have some kind of crap attack at me cant say im very impressed with vista the concept behind some of its features is well intended but UAC?? if thats not the devils work i dont know what is all i want to do is replace one script that i probably shouldn't have modified and now i wanna replace it but Vista wont let me if this work i will father your children and i dont think you should be deleting System Volume Information i think thats important

  39. Scott

    I was able to use the commands to take control of the files, but not the folders. System was the only authorized user, administrator status didn't matter. After the folders were empty then they were next to impossible to remove. However, I created a new user with administrator privileges. I logged on with the new user and was able to move the folders to the desktop of the new user. I then logged off, logged back on to regular userID and then deleted the user I had created. The folders were deleted with the user.

  40. Chris Westfall

    Im using vista ultimate 32bit
    And i think i might have a virus running on my rundll32.exe, is it okay for me to delete it because i thought this is a major part of your computer, and it probably wouldnt run without it…
    if you have any ideas on how to fix this virus, please let me know….Please Help!!!

    christopherctw@yahoo.com

  41. Chris Westfall

    actually i dont know if its .exe it could be something else, but theres deffinately something wrong with a rundll32 file

  42. Maarten Elshof

    So, how do I give back ownership to the TrustedInstaller after I'm finished replacing files?
    Thnx for any advice

  43. veronika

    THANKS!! Works perfectly.

  44. DaiLaughing

    rundll32 is just a handler for other programs. So if they cause problems the error message will often mention rundll32 but that is not your problem. Four main suggestions for you:

    1) Get antivirus and run it - AVG works very well for me and is free, if it doesn't find anything then you probably don't have a virus - just some badly behaved software
    2) Get an anti-spyware scanner and clean your system with it
    3) Uninstall as many programs as possible especially those free utilities, toolbars etc.
    4) Check in msconfig (Start - Run, type msconfig) for the programs starting at boot (Startup tab) and untick anything you don't like the look of or don't care about (don't worry you can go back in there later and put the ticks back one by one if you make a mistake)

  45. Marcos

    hi im trying to delete a Roxio program file and i tried following the steps above with no success. Everytime i press delete it says you need permission to perform this action. They are dll files that im trying to remove. I installed roxio on my computer not realizing it was incompatible. It show up on my add remove programs. When i try doing it this way, it says 'windows installer service cannot be accessed, this can occur if windows installer in not correctly installed". Do you guys have any idea what i can do?

  46. jonathan

    hi do it really work because i have upgrade from xp to vista and i have done formet to xp and the windows vista file has stead on my competr and i cannot delete the windows vista file please help!

  47. Marcos

    Hey jonathan have you tried DR. Delete. google it. I managed to delete some hard files that way. Its a free tool

  48. Baran

    i was going to be mad!!! i got some win32 jeefo on some vista files.but they were not running.they were just staying in "system32/bla bla" folder. i tried kaspersky to get rid of them but it was useless.i got both XP and Vista on same computer and kaspersky was just telling me that the files are infected what do i want to do and option is "skip" nothing more.and it was popping up every minute! and it was happening on both vista and xp.than i saw this thread, made a list of infected files, created 2 different bat files for both commands.and run them.after that i pressed "disinfect all" and voila.they were clean as a baby. thank you so much for this info :)

  49. Daniel Jarrett

    Do you know if SP1 for Vista Home Premium has interfeared with the Remote Desktop fix that you helped with. I seem to be having trouble with it now.

    Thank you for any advise,
    Daniel S. Jarrett
    jarrett001@comcast.net

  50. Jess

    I just got my vista ultimate laptop today.
    I followed the steps as above.
    I also had the problem of getting to the cacls step.
    It says its depreciated and to use Icacls instead. I did that, following the same syntax and it tells me the filename, directory name, or volume label syntax is incorrect.

    What should I do?
    I'm trying to patch my uxtheme.dll along with some others to use some themes…

    Help

  51. nocash350

    Nothing worked for me. i still receive a message telling me i need permission

  52. Sarah James

    I've used the above to delete or modify some files and it worked great - thanks!

    But now I'm stuck with a different problem: I have an folder with empty subfolders. I want to delete the lot, but Vista says 'Can't find the item'
    'The item no longer exists in this folder. Check the location of the item and try again'.
    Well, I've tried again and again. I've taken possession of the folder etc., I can even move the folder, but I can't delete the **** thing.

    Anybody any suggestions? Help is very welcome!

    Thanks,
    Sarah.

  53. nick

    Hi

    can I use the same method to get rid of unwanted .lnk files that I cannot seem to get to delete anyother way?

  54. Niels

    Great! i was hoping to find this information for a while :D
    Can't thank you more!

    Keep up the good work

    Thanks,
    Niels


Leave a Comment




Leave your friendly comment here. If you have a computer help question, leave it on the forums instead.

Note: Your comment may not show up immediately on the site.

Copyright © 2006-2008 HowToGeek.com. All Rights Reserved.