%SystemDrive%

Todd Whiteman toddw at ActiveState.com
Wed Feb 15 14:07:10 EST 2006


Another hack:
drive = os.popen("echo %SYSTEMDRIVE%").readline().strip()

rtilley wrote:
> Is there a proper way to get this variable from Windows? I know it's in 
> the registry, but I'd rather not go there. I could not find a CSIDL 
> shell constant for it either. I've been doing this:
>
> os.chdir('/')
> sys_drive = os.getcwd()
> print sys_drive
> C:\
>
> This seems too much of a hack and maybe not 100% right all of the time. 
> How could it be done better?
>   



More information about the Python-list mailing list