• +91 9723535972
  • info@interviewmaterial.com

QTP Interview Questions and Answers

Question - What are the ways in UFT to get system environment variables in UFT?

Answer -

There are three ways to get system environment variables in UFT

Use the WSH shell object

Use WMI’s Win32_Environment Class
Read variables from the registry
Set myShell = CreateObject (“WScript.Shell”)

WScript.Echo myShell.ExpandEnvironmentStrings( "%PATHEXT%" )

myShell=Nothing,
The output will be .BAT;.CMD;.VBS;. VBE;. JS;. JSE

Other user variable, like TEMP, overwrite their system counterpart

Set myShell = CreateObject( "WScript.Shell" )

WScript.Echo myShell.ExpandEnvironmentStrings( "TEMP=%TEMP%" )

myShell=Nothing
The output will be

TEMP:C:\DOCUME~1\You\LOCALS~1\Temp

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners