From: KUSUNOSE Toru Date: 2004-02-28T18:34:33+09:00 Subject: Re: Profile-independent directory specification for NT? Hi, In message <20040225194848.GA24254@foobar.solution-x.com>, "Florian G. Pflug" wrote: >On Wed, Feb 25, 2004 at 10:03:51PM +0900, Moran, Craig M (BAH) wrote: >> Is there a way to specify a directory in Ruby that is profile-independent >> for the Windows NT variants? For example, if I wanted to do this in VBA for >> the currently logged in user's My Documents folder, it would look like this: >> ProfilePath = Environ("USERPROFILE") & "\My Documents\" >> This way, regardless of who is logged in and runs the script, it will always >> point to their own My Documents folder. Thanks in advance for the help- >Be aware that this is only correct on english versions of windows. In german >e.g, the folder is not named "My Documents" but "Meine Dateien" (or >something like that - don't use windows very often ;-) ). > >I believe that the windows registry is the right place to get that >information from. (I have to admit though, that I have no idea how you could access >the registry from ruby, and where you find this information there). Using Windows Scripting Host, you can do: require 'win32ole' shell = WIN32OLE.new("WScript.Shell") ProfilePath = shell.specialFolders("MyDocuments") -- KUSUNOSE Toru mailto:kusunose@hcn.zaq.ne.jp