jeudi 9 avril 2015

Batch file conditions

I have this;



Echo -------------------------------------------------------
Echo UNISTALL ANY PREVIOUS VERSIONS OF JAVA (32 and 64 Bit)
Echo -------------------------------------------------------
SET regVar32=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
SET regVar64=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\

SET myCMD=REG QUERY %regVar32% /s /f "*java 7*"
FOR /f " usebackq delims={} tokens=2" %%i IN (`%myCMD%`) DO ( msiexec /x {%%i} /qn /norestart )

SET myCMD=REG QUERY %regVar64% /s /f "*java 7*"
FOR /f " usebackq delims={} tokens=2" %%i IN (`%myCMD%`) DO ( msiexec /x {%%i} /qn /norestart )


And I want to be able to put a condition where the rest of the code will only execute if the above it true. Otherwise just quit the Batch file.


I don't seem to be able to get it correct. Could anyone please help?


Thank you all in advance.


Aucun commentaire:

Enregistrer un commentaire