Get SystemDrive variable

Discussion in 'Python' started by JY Doyon, Jul 30, 2004.

  1. JY Doyon

    JY Doyon Guest

    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
    JY Doyon, Jul 30, 2004
    #1
    1. Advertising

  2. JY Doyon

    JY Doyon Guest

    Found it.

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

    Thanks

    "JY Doyon" <> a écrit dans le message de
    news:_xtOc.26574$...
    > 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
    >
    >
    JY Doyon, Jul 30, 2004
    #2
    1. Advertising

  3. 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 <> 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
    >
    >
    =?iso-8859-15?Q?Pierre-Fr=E9d=E9ric_Caillaud?=, Aug 1, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rtilley

    %SystemDrive%

    rtilley, Feb 15, 2006, in forum: Python
    Replies:
    8
    Views:
    754
    Bryan Olson
    Feb 17, 2006
  2. mfglinux
    Replies:
    11
    Views:
    678
    Roberto Bonvallet
    Sep 12, 2007
  3. Pete Mahoney

    How to get Variable value not Variable name.

    Pete Mahoney, Jul 24, 2003, in forum: Javascript
    Replies:
    11
    Views:
    253
    Richard Cornford
    Jul 25, 2003
  4. David Filmer
    Replies:
    19
    Views:
    221
    Kevin Collins
    May 21, 2004
  5. tnhoe
    Replies:
    4
    Views:
    680
Loading...

Share This Page