Using System and Environment Variables in your scripts

Chris ColosimoChris Colosimo Posts: 71 admin
edited February 2017 in Virtualize

You can use system/ environment variables in your scripts. Here is a simple example

from com.parasoft.api import *
from java.lang import System


def systemVariables (input, context):
    #This is for Windows
    Application.showMessage("COMPUTERNAME = " + str(System.getenv("COMPUTERNAME")))

    #This is for Linux
    #Application.showMessage("COMPUTERNAME = " + str(System.getenv("HOSTNAME")))

Here are a few nice web pages that provide what variables are available

Linux

http://man7.org/linux/man-pages/man7/environ.7.html

Windows

http://best-windows.vlaurie.com/environment-variables.html

Sign In or Register to comment.