Set Environment Variables
In case you have to explain someone how to set environment variables, who is not familiar with it, this script could save you some time.
Features:
- Set user variables
- Set system variables (with automatic permissions check)
- The script ensures that entered variable names and their values are not empty to prevent errors
- Append your inputs to user or system Path variables
- Before editing the user and system path variable, the script creates a respective backup of a variable in the working directory. Actual user_path_bak.txt and sys_path_bak.txt
- Show user and/or system Path variable
Future Ideas:
It would be great if the script could also remove something from the path variables. Batch is not suitable for this, but I will do further considerations.
In a short test on a VM, just copying the command "pathman" to a Windows 10 system worked smoothly and no installation of the Windows Resource Kit was needed.
Additionally, unlike setx, pathman has a decisive advantage. Setx is unable to add more characters to path variables longer than 1024 characters. Even if the path variable already is much longer, setx would simply truncate it.
For now, i will provide two scripts. One based on setx, the other on pathman. In the setx variant i built in some handlings which will keep you away from destroying your PATH variable. Please take a look at the comments and jumpmarks in the script for further information.
Download:
set_environment_variables_setx.zip
set_environment_variables_pathman.zip