Admin Script Editor 3.2 Send comments on this topic.
ScriptPackager Environment Variables
Welcome to Admin Script Editor v3.2 > Features > ScriptPackager > ScriptPackager Environment Variables

Glossary Item Box

Script Packager Environment Variables

Some dynamic information about a packaged script is provided via Windows environment variables. To determine where the script is running from, what command line arguments may have been passed, or to learn the registry path for the executing user, these environment variables may be invaluable to your script.

ISEXE - This is used to identify if the script is being run as a packaged executable or not. If it is, this variable will be set to a value of one (1).

ASEEXE and ASEEXEPATH - These environment variables will provide the full path, or path and file name of the executing packaged script. Due to the extraction and execution of the script files, the actual current directory of the script will (by default) be a subdirectory of the user's temp directory. Therefore, if you wish to reference other files that may be located with the executable itself, make use of the %ASEEXEPATH% variable.

%ASEEXE% = C:\MyPackages\MyPackage.exe

%ASEEXEPATH% = C:\MyPackages\

ASESCRIPTPATH - This variable represents the location of the script from where it is actually being executed. This will equate to that of the temporary directory generated, the location of which is based on the "Extract To" location specified for the package.

"C:\Documents and Settings\bkelly\Local Settings\Temp\123456789\Scripts\"

ASECURDIR - This variable represents the current directory at the time the executable is launched. This is normally the same as %ASEEXEPATH% unless the EXE package is called via a command prompt and the current directory does not reflect the directory in which the package resides.

ASEEXEARGS - Want to base actions on what command line parameters are provided to the packaged executable? Just have a look at %ASEEXEARGS% to see what (if any) additional parameters or switches may have been provided at execution.

ASEHKCU - Because you have the option of running a script using alternate credentials, any references to HKEY_CURRENT_USER will be that of the specified account (and not that of the user running the packaged script.) Therefore we have provided the %ASEHKCU%  environment variable. This variable reflects the HKEY_USERS path to the executing user, which is the equivalent of HKCU (HKEY_USERS\<user SID>).

ASEUSERID - When running with alternate credentials, the username returned by the script will be that of the specified user account. To obtain the domain and user name of the user running the packaged script use the %ASEUSERID% environment variable. (New in ASE v2.2)

<domain>/<userid> (example: itripoli/bkelly)

Note: ASEEXEPATH and ASESCRIPTPATH both end with a backslash (careful not to include an additional backslash in your strings!)