I have tested this on both Windows 7 Enterprise x64 and Windows 10 Pro x64. I don't know if the same behaviour occurs in other versions of Windows. Other people with other versions of Windows may be able to test and verify.
I'm using the version of easy-rsa which was bundled with OpenVPN v2.4.4, installed by default into C:\Program Files\OpenVPN.
The vars.bat.sample script contains this line:
Code: Select all
FOR /F "tokens=2*" %%a IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\OpenVPN"') DO set "PATH=%PATH%;%%b\bin"
Code: Select all
reg query "hkey_local_machine\software\openvpn"
HKEY_LOCAL_MACHINE\software\openvpn
config_dir REG_SZ C:\Program Files\OpenVPN\config
config_ext REG_SZ ovpn
exe_path REG_SZ C:\Program Files\OpenVPN\bin\openvpn.exe
log_dir REG_SZ C:\Program Files\OpenVPN\log
priority REG_SZ NORMAL_PRIORITY_CLASS
log_append REG_SZ 0
(Default) REG_SZ C:\Program Files\OpenVPN
disable_save_passwords REG_DWORD 0x0
ovpn_admin_group REG_SZ OpenVPN Administrators
Instead, the variable %%b should be set to the (Default) value of the key: "C:\Program Files\OpenVPN".
The REG QUERY command supports the switch "/ve" to restrict the result to the (Default) value:
Code: Select all
reg query "hkey_local_machine\software\openvpn" /ve
HKEY_LOCAL_MACHINE\software\openvpn
(Default) REG_SZ C:\Program Files\OpenVPN