edit all environment variables- advance tab my computer- through QTP
is there any code in qtp that can go to my computer select properties, then go to advance tab, environment variables and can ed开发者_Go百科it all the variables that already exist.
Regards, Jitu
Presumably your goal is not to test setting environment variables through Advanced tab, but to change them from a QTP script anyhow.
You can easily change them using VBscript capabilities. Look at these functions:
Public Function GetEnvVariable(ByVal strEnvVarName)
Set oShell = CreateObject( "WScript.Shell" )
GetEnvVariable = oShell.ExpandEnvironmentStrings(strEnvVarName)
End Function
Public Function SetEnvVariable(ByVal strEnvVarName, ByVal strNewValue)
Set oShell = CreateObject( "WScript.Shell" )
oShell.Environment.item(strEnvVarName) = strNewValue
End Function
Here you can read more about environment variables. Also WshEnvironment Object may be useful for you.
精彩评论