I have this batch file to append a environment variable if not exists
setLocal EnableDelayedExpansion
set echo off
set envPath=%PATH%
set comPath=";D:\Package\Libraries\Lib"
if x%envPath:comPath=%==x%envPath% (
setx PATH "%PATH%;D:\Package\Libraries\Lib" /M
)
pause
But its not working and says file was unexpected this time
I wrote based on Batch file: Find if substring is in string (not in a file)