On a Windows system, the path: D:\ is known as the HOMEPATH. ---- [LV] Can anyone explain how Tcl makes use of this? What does HOMEPATH mean? - [RS] is not sure, but this page was prepared to live from [Tcl syntax help]. ---- On my windows box my HOMEPATH is: \Documents and Settings\jrankin I'm not sure why it would ever be the root of d, unless it has been explicitly set that way. Given the location of this path, perhaps it refers to the Windows equivalent of the user's home directory? - [WJR] ---- [ZLM]: C:\>set HOME HOMEDRIVE=P: HOMEPATH=\ HOMESHARE=\\acefpscpd001\PSI0005JLM$ C:\>p: P:\> P:\>cd %HOMEPATH% P:\> P:\>c: C:\> C:\>cd %HOMEPATH% C:\> ---- [BR] 2003-10-28: On my system (W2K) I see this: c:\> set HOME HOMEDRIVE=C: HOMEPATH=\Documents and Settings\benny I always interpreted this as that MS wanted something like $[HOME] on Unix but in two pieces so that you can use it in batch files like %HOMEDRIVE% cd %HOMEPATH% Note for those not familiar with Windows command/batch language: On Windows, plain '''CD''' doesn't change the drive. You do that by just giving the drive name, as the first line in the code example does. Tcl seems to think the same, it synthesizes a [HOME] variable for me from those bits, if I don't have one: c:\> set HOME HOMEDRIVE=C: HOMEPATH=\Documents and Settings\benny c:\> tclsh % set env(HOME) C:\Documents and Settings\benny ---- [TV] XP SP1 gives: HOMEDRIVE=D: HOMEPATH=\Documents and Settings\someinstallinheritedname SystemDrive=D: SystemRoot=D:\WINDOWS cygwin on that sys (the most recent on , complete install) gives: HOMEDRIVE=D: HOMEPATH='\Documents and Settings\someinstallinheritedname' KDEHOME=/home/someinstallinheritedname/.kde2 PWD=/home/theo SYSTEMDRIVE=D: SYSTEMROOT='D:\WINDOWS' USER=theo USERNAME=theo USERPROFILE='D:\Documents and Settings\someinstallinheritedname' WINDIR='D:\WINDOWS' Under cygwin, like on unix, you have a 'mount' command, where you can chose to mount to: * a relative dir (probably not handy unless you want independent partion file trees with overlapping dirs) * something like /bin , which refers usually to the c:/cygwin/bin or /cygdrive//cygwin/bin * drive defined path /cygdrive/c/cygwin/bin Within cygwin, apart from using 'mount /cygdrive/c/ c:' you can hard define the partition not by D:/ but by /cygdrive/d/ . Cygwin can also have stored variables in the registry, which seem to be tagged by cygwin or cygnus, but I'm not sure all could be found that way. Setting variables under the [cygwin] unix emulation is done by the export instead of set command, and can be automatically set at startup by /etc/profile and just before bash shows the prompt by ~/.bashrc (unfortunately with the tilde interpreted by some variable I don't know, and which is by default linked with the windows login name. ---- [RA] Thanks to some help from Kaitzachu, I managed to make the following function that uses the Windows registry entries to get the right "My Documents" directory: proc GetHomeDir { } { global env # Check if we're using windows if { [expr [string compare "$::tcl_platform(platform)" "windows" ] == 0] } { package require registry 1.0 set env_home [registry get {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders} {Personal}] } else { set env_home $env(HOME) } return $env_home } It returns the "My Documents" directory on windows or the user's homedir on Unix/Linux. Not tested on Mac OS (X). --- [MG] For me on Win XP Home SP2, I have HOME, HOMEDRIVE and HOMEPATH elements in my $env array in Tcl. That is, from the wish prompt: % parray env HOME* env(HOME) = C:\Documents and Settings\User env(HOMEDRIVE) = C: env(HOMEPATH) = \Documents and Settings\User I noticed that you can't use HOMEDRIVE and HOMEPATH to build up HOME manually, though, or at least not without some editing - the only way to get C:/Documents and Settings/User back from a [[file join]] is if you start with "C:/" and "Documents and Settings/User" - with no trailing slash on the drive, or with a leading slash on the path, the return value doesn't show the drive letter (and so refers to the path on the current volume, not necessary on $env(HOMEDRIVE).) ---- [[Category ?]]