开发者

edit all environment variables- advance tab my computer- through QTP

开发者 https://www.devze.com 2023-02-16 10:05 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消