As of right now when we update Java on a PC which users a certain program we use I have had to manually update the system path environment variables with the latest Java version number in the path (C:\Program Files (x86)\Java\jre1.8.0_141\bin\client
).
My goal is to automate this process via a DOS script if possible. I am far from a coder but would like this script to search for the "jre1.8.0_141"
then replace it with whatever build number the latest update is in the %PATH%
variable. This way I can leave each individual PC's environment variables in tact and only edit the Java string.
I have looked at merging entries with the registry but would like to avoid that as all systems are not identical.
This is my script so far:
This is what I have so far:
REM Exports the Systems Environmental Variables
reg export "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "C:\Software\%COMPUTERNAME%_ENV_VAR_BACKUP.reg" /y
REM Searchs for Java path and changes if necessary
IF "%PATH%" = "*jre1.8.0_141*" (
THEN **NOT SURE WHERE TO GO FROM HERE**
)
I know what I want to accomplish but I have no idea how to translate that into a working batch file so I apologize I have no more information for you.
Thank you for any help.