Search code examples
citrixxenapp

Setting environment variable before running published application in citrix


I have a published application in my citrix server that flexes based on an environment variable which needs to be set in the server, after the session starts. Is there an easy way to do this?


Solution

  • The easiest way is to use .vbs script to set environment variable and then launch an application.

    For example:

    set ws = wscript.createobject("WScript.shell")
    set systemEnv = wshShell.Environment("SYSTEM")
    systemEnv("YourVariable") = "Your value"
    ws.run("notepad.exe"), 0, true
    

    Flags:

    0 = Hidden
    1 = displayed
    True = Waits till command has completed before moving to next
    False = Does not wait for command to complete before moving to next