How to create a file on users XP desktop

Tim Golden tim at timgolden.me.uk
Sun Oct 7 13:30:36 EDT 2007


Tim Chase wrote:
>> You are assuming the system is not localized, that won't work if you
>> distribute your applications internationally. In my system it is not
>> "Desktop", it is "Escritorio", and I guess it will vary with every
>> locale. Does someone know a way to find out what name does the desktop
>> have?
> 
> I believe you need to read the Desktop value from
> 
> """
> HKEY_CURRENT_USER\software\microsoft\windows\currentversion\explorer\shell
> folders
> """
> 
> which should (in my understanding) hold the full path of the
> particular folder(s) of interest at that location, including
> across localizations.
> 
> -tkc

Ideally, use the shell API exposed by pywin32:

<code>
from win32com.shell import shell, shellcon

desktop = shell.SHGetFolderPath (0, shellcon.CSIDL_DESKTOP, 0, 0)

</code>

For slight convenience:

   http://timgolden.me.uk/python/winshell.html

TJG



More information about the Python-list mailing list