Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Get SystemDrive variable

Reply
Thread Tools

Get SystemDrive variable

 
 
JY Doyon
Guest
Posts: n/a
 
      07-30-2004
I'm writing a script that copies all information from the "Documents and
Settings" folder for backup purposes. My problem is that some machines have
the OS installed on a different drive than C:\. Is there any way to get the
environment variable "SystemDrive" with python?

Thanks for the help


 
Reply With Quote
 
 
 
 
JY Doyon
Guest
Posts: n/a
 
      07-30-2004
Found it.

srcdrv = os.getenv("SystemDrive"). I forgot to put the quotes at first.

Thanks

"JY Doyon" <(E-Mail Removed)> a écrit dans le message de
news:_xtOc.26574$(E-Mail Removed) ...
> I'm writing a script that copies all information from the "Documents and
> Settings" folder for backup purposes. My problem is that some machines

have
> the OS installed on a different drive than C:\. Is there any way to get

the
> environment variable "SystemDrive" with python?
>
> Thanks for the help
>
>



 
Reply With Quote
 
 
 
 
=?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?=
Guest
Posts: n/a
 
      08-01-2004

Not only that, but different versions of Windows have it in a different
place. Sometimes it's in c:\windows\mydocuments or something. You better
get the folder path for Documents and Settings from the registry rather
than starting from C:

On Fri, 30 Jul 2004 11:10:50 -0400, JY Doyon <(E-Mail Removed)> wrote:

> I'm writing a script that copies all information from the "Documents and
> Settings" folder for backup purposes. My problem is that some machines
> have
> the OS installed on a different drive than C:\. Is there any way to get
> the
> environment variable "SystemDrive" with python?
>
> Thanks for the help
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
%SystemDrive% Folder on Desktop & System Restore error 1075 Cybrespyydre General Computer Support 0 05-28-2007 07:19 PM
%SystemDrive% rtilley Python 8 02-17-2006 03:26 AM
if instance variable get initialize after assigning some values or after constructor then when does static variable get initialize Tony Morris Java 3 02-04-2006 08:39 AM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM



Advertisments