Page 1 of 1

Using environment variables

Published: September 29, 2016 - 12:49 PM
by fludo67
Good morning,

I would like to understand how environment variables are used in wapt packages.
For example, I want to launch a VBScript from a command line:

Code: Select all

cscript.exe mondossier\monscript.vbs
cscript.exe is located in c:\windows\system32, so its environment variable would look something like %systemroot%\system32

In my setup.py file, how do I interpret the systemroot variable? (I have several somewhat unusual installation scenarios where Windows is not stored in C but on another drive.)

Thank you in advance for your insightful answers

Re: Using environment variables

Published: September 29, 2016 - 4:51 PM
by Aedenth
Good morning,

You can use the os module from the Python standard library

Code: Select all

import os

os.environ["SYSTEMROOT"]
which returns "C:\Windows" if Windows is indeed installed on C:\