Directory c:\%USERPROFILE% created

Igor Pechtchanski
Thu Jun 9 13:28:00 GMT 2005

On Thu, 9 Jun 2005, Systemtechnik wrote:

> Hello,
> i was wandering about strange folders created in the root directory of
> my Cygwin-Enhanced PCs and found out that everytime i start installer
> programs from within a cygwin shell, a folder called %USERPROFILE% is
> created in the base directory of the pc's harddisk.
> I found out that if i start a command-shell from windows there is an
> environment variable called "%USERPROFILE%" which points to the current
> logged in users directory. In cygwin-shells this variable is missing.
> So everytime a windows-process tries to access the current users
> profile-dir (to store some ini's or whatever), the variable does not
> resolve but will be taken literal, so this directory will be created.
> In other words: %USERPROFILE% does not point to
> "c:\WINNT\Profiles\username", resp. "%SystemRoot%\Profiles\username"
> like it should. The effect is that the installer will fail, which is
> very bad if running "silent" setups.
> To avoid this i've set $USERPROFILE to the appropriate profile-directory
> for the users in his .profile in cygwin's /home/username.
> This seems to work, but do i make something wrong ? Is there a better
> way to do this ?
> Are there any environment-variables or programs to resolve the current
> users Windows-Profile-Directory, instead of setting it literally in
> .profile ?

Since you didn't attach the output of "cygcheck -svr" as requested in
<>, this is just a guess.  Your problem
isn't with %USERPROFILE% per se, it's with some other variable (usually
%HOME%) that contains "%USERFPROFILE%" in it.  The environment is stored
in the registry, and there is a special REG_EXPAND_SZ value type that
causes any embedded variable references to be expanded when referenced.
Variables that refer to other variables usually have that value type.
Some buggy installation programs change the type of that value to REG_SZ
(a regular non-expandable string), and therefore, when the value is read,
the string "%USERPROFILE%" remains a literal string (i.e., isn't

You need to look through your environment and see what variables contain
the string %USERPROFILE%.  You then need to go to the environment key in
the registry, rename the values that have wrong types, and re-create them
with the correct REG_EXPAND_SZ type.  This isn't a Cygwin problem, but
rather one exposed by Cygwin, since it uses the values of the variables to
find out which path to use for $HOME (and creates that directory).

      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list