Often when re-installing windows you are left with old.windows directories, old program files directories and so on. Often the permissions left on this folder are a real pain to remove by using the windows folder security window. Even after taking ownership and applying to all subfolders and object you might still get access denied on files.
Here is a sure way to take full ownership and to remove a directory in Windows 7 from the command prompt. Make sure to run CMD/Command Prompt as an administrator.
At the command prompt, type takeown /F <DriveLetter>:\<FolderName>\* /R /A, and then press ENTER.
Note When you run this command, you are granted ownership of the administrator group for the folder, of all the subdirectories in the folder, and of all the files in the folder.
At the command prompt, type cacls <DriveLetter>:\<FolderName>\*.* /T /grant administrators:F, and then press ENTER.
“Note When you run this command, administrators are granted full rights to all files and to all folders.”
At the command prompt, type rmdir /S /Q <DriveLetter>:\<FolderName>\, and then press ENTER.
Note When you run this command, all subfolders and all files in the specified folder are deleted. Additionally, the specified folder itself is deleted.



































