[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: system32 directory

Tim Golden

3/6/2008 8:43:00 AM

Robert Dailey wrote:
> Hi,
>
> Is there a way to get the System32 directory from windows through python?
> For example, in C++ you do this by calling GetSystemDirectory(). Is there an
> equivalent Python function for obtaining windows installation dependent
> paths?

<fishing advice>
First thing to do when asking "How do I do X in Python under Windows?"
is to stick -- python X -- into Google and you get, eg:

http://aspn.activestate.com/ASPN/docs/ActivePython/2.2/PyWin32/win32api__GetSystemDirectory...

which suggests that the win32api module from the pywin32 modules has
the function you need.
</fishing advice>

And sure enough...

<dump>
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32api
>>> win32api.GetSystemDirectory ()
'C:\\WINDOWS\\system32'
>>>
</dump>

TJG