Tag Archives: Environmental Variable

Add or modify an environmental variable (BAT, VBS)

Purpose: Add or modify a windows OS environmental variable from command-line

It is not very unusual that an application requires an environmental variable to function properly. Depending on how deep into the application packaging you must dive, sooner or later you will be face to face with an environmental variable application. Most common scenarios is that something will work a lot easier with a custom environmental variable or that the actual windows PATH variable must be modified to include the new application.

The most important theory is the following:

User environmental variables: HKEY_CURRENT_USER\Environment
System enviromental variables: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Continue Reading

Create a Folder from an Environmental Variable (VBS)

Purpose: Create a folder, which name is received from an environmental variable.

You might need to create a folder (deliver a file, get the string, etc.) based on a custom environmental variable.  In my scenario, I had an installation done differently across the domain. The only way to deliver a file to the installation directory was to either check which folder exists in the workstation (and hope you found all the permutations) or use the environmental variable (that was same in each workstation). I chose the environmental variable. In this example, a usually existing environmental variable %WINDIR% (the location of the windows installation) is used.

Usage: cscript.exe IT_APP_VBS_CreateFolderFromEnvironmentalVariable (no parameters exist)

Configuration: You need to change the folder location and environmental variable to match.

Continue Reading