QTP has basically 2 types of environment variables.
- Built in - e.g OS - operating system information - This is read only
- User Defined - User can define his own variables - This can be edited or modified.
To create user defined variables, you have to go to the settings of the test and click on environment Tab.
Select variable type as "User defined". Then add any variable and it's value.
Example -
'Create environment variable at runtime -
Environment.Value("MyDirectory") = "c:\test"
Environment.LoadFromFile "c:\Env.ini" ' Load varaibles from ENV.ini
Format of ini file should be like this -
[Environment]
var1=abcd
var2=xyz
[Environment]