Originally posted by Gorilla
Do you guys see something wrong with this statement? I keep getting an error
FOR /F "tokens=3 delims " %%G IN (REG query "HKLM\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC" | FIND "ProductVersion" DO @echo %%G
The whole statement is basically wrong. You're missing an equal sign after delims (which defaults to space anyway). And you should just use /v ProductVersion instead of find. I don't think pipe works inside a for command like that.
Anyway, I also got your PM, and now that I realize you only need to test for a specific version there is an easier way to do this.
See, you don't need to isolate the version number, you just need to test and see if the string matches the version you're looking for. This script will do what you want:
Code:
REG query "HKLM\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC" /v ProductVersion | FIND "11.0.4000.2295"
IF NOT ERRORLEVEL 1 SymantecUpdater.exe
That will run the SymantecUpdater.exe file if the version 11.0.4000.2295 is found. If you want it to run if that version is NOT found then remove the "NOT" from the IF statement.