Results 1 to 2 of 2
  1. #1

    Reg: Create System Environment Variable in QTP

    Hi All

    Is it possible to Create System Environment variable(ie. Windows Environment variable) using QTP. I need that System variable for Execution purpose.

    If any one idea please share it.


  2. #2

    Re: Reg: Create System Environment Variable in QTP


    'You can able to do using Wscripts

    Set objWSH = CreateObject("WScript.Shell")
    Set objUserVariables = objWSH.Environment("USER")

    'Say you want to add a System or a User variable. Pretty simple, just use the
    objUserVariables("Test_USER_VARIABLE") = "User Variable Sir!"
    msgbox objUserVariables("Test_USER_VARIABLE")

    Set objSystemVariables = objWSH.Environment("SYSTEM")
    MsgBox(objSystemVariables ("PATH"))
    objSystemVariables("Test_SYSTEM_VARIABLE") = "System Variable Sir!"
    msgbox objSystemVariables("Test_SYSTEM_VARIABLE")

    'But if you want to set the system variable require custom account with Admin rights.

    'hope it will help



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 04:13 PM.

Copyright BetaSoft Inc.