Sunday, March 11, 2012

The chown command equivalent in Windows 7

As 'su - chown' does not work in Cygwin, there is a alternative in Windows 7.
Log in as the user the files should be changed TO and run Command Prompt as administrator.
Run the follow command (or similar one with different parameter combination)

> takeown /F <directory name> /R


  1. The su and chown in my Hamilton C shell do work as expected on Windows 7, allowing you to su to other user, elevated if desired, and chown (take) the file.

    Unlike, e.g., runas, my su and sudo pass the current directories, environment variables and long command lines and allow you to wait for and retrieve the return code in a script.

  2. with takeown u can not give the own to another one without making him an administrator