Reference: http://blog.csdn.net/zjjyliuweijie/article/details/6577037
http://blog.csdn.net/huangzhtao/article/details/6038504
http://blog.csdn.net/hu_shengyang/article/details/7828998
Why is the Cygwin installation directory (after Win7 reload) so difficult to remove?
Under normal circumstances, Cygwin's anti-Setup program is the best choice to remove the directory. But Win7 's reload will reverse the installer, which is a bit of a hassle after you delete the directory. Because Cygwin is simulating Linux's rights management system, there are some conflicts with Windows ' default rights Management. If you don't believe it, you can right-click on the security option in the directory properties and you'll see some unidentified users (with question marks) in the "Group or user name" column, which is actually the user before the system reload, and it will have a string of numbers that are uniquely identified. So even if we re-install the system and then use the original user name, this unique identification number is completely different. As a result, our currently logged in account has no permissions to modify or delete the file.
How do I remove Cygwin?
Under Win7, people do not have the ability to modify or delete folders and files, generally take the first permission to modify the processing mode, this method usually includes two steps: First modify the target folder and its file owner, so that the current user to gain access to it. However, in Win7, if you want to delete a folder, you need to have permissions on all the files and folders under the folder to delete, but in the graphical interface, the user right to modify a folder is only valid for the first layer of files and folders under that folder, and cannot be recursively to deeper files and folders. and Cygwin installation directory depth is very large, and many files, manual modification will appear very cumbersome, time-consuming, so I strongly recommend that you choose the 2nd method, program modification.
Manual removal:
- Right-click to delete the Cygwin folder, select Properties----security-------owner----edit, change the owner to your login account, and tick the "replace the owner of child containers and objects" below.
- In the properties---security---Advanced dialog box, select "Audit tab", click "Continue", click "Add", enter: Everyone, click "OK" to add the Everyone account, in the popup dialog box "Full Control" followed by the Allow tick, tick " Replace all child object permissions with the permissions that can be inherited from this object, and click OK.
Now, we can delete the Cygwin folder successfully. Obviously, manual removal is a very painful task.
Program Removal:
- Use Takeown.exe to modify the permissions of the Cygwin folder and its child files. Takeown.exe can be downloaded from the Internet, after the download is complete, put Takeown.exe in the Cygwin installation directory, and then enter in CMD:
TAKEOWN.EXE/F */R
This command takes care of modifying the owner of all files and folders in the directory under takedown to the current user, and can recursively manipulate the directories to take effect on all subdirectories and sub-files.
- Use the commands provided by the Win7 system to modify the user's access rights to all subdirectories under the target folder. The order is icacls, and its usage can be found on the Internet.
Icacls \cygwin/t/grant user:f
This command gives the user the full Control (F) permission to the Cygwin folder and all its subdirectories and sub-files.
The above two steps require a certain amount of processing time, 2, 3 minutes or so, please be patient and wait for it to complete.
After Win7 reload, how do I delete the Cygwin directory?