Saving Files Under Windows

Tim Golden tim.golden at
Mon Jun 16 12:03:23 CEST 2003

> Dennis Lee Bieber:
> Is there some easy way to define M$'s "My <bleeping this & that>" 
>   to use a separate partition?

Someone, somewhere recently has pointed out that TweakUI and various
 other tools from Microsoft and elsewhere will do this. If you're
 administering an NT domain (which you're obviously not on your 
 own laptop, unless you have delusions of grandeur) then the NT
 Policies will allow you to do this as well.


In fact, there is a lot to be known about MS Windows in its various
 incarnations that isn't known by the casual user, and not even by
 the administrators in some cases. As a rule, direct access to the
 registry is not the best way to read/write system info (unless of
 course there is no other), not least because it changes so damned
 often: what looked like a stable lookup in Win98 suddenly isn't there
 when you get to Win2k. 
Functions like SHGetSpecialFolderPath, available via the shell module 
 in win32all will get pretty much anything you like of the [My Documents]
 variety, regardless of the environment, changes of location, use of 
 domain etc. At least, I've used them across a mixed Win2k / Win9x 
 setup with no problems at all.


from win32com import storagecon
from import shell, shellcon

def desktop (common=0):
  return shell.SHGetSpecialFolderPath (0, (shellcon.CSIDL_DESKTOP,

def application_data (common=0):
  return shell.SHGetSpecialFolderPath (0, (shellcon.CSIDL_APPDATA,

def personal_folder ():
  return shell.SHGetSpecialFolderPath (0, shellcon.CSIDL_PERSONAL)
my_documents = personal_folder

etc. etc.


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the Python-list mailing list