

I haven't tested it since I don't have iTunes installed, so you might need to salt to taste. Here's an illustration using a Batch + PowerShell hybrid script. I'd use PowerShell for the heavy lifting here. Even though 12.10.x.x is numerically greater than 12.5.x.x, it is alphabetically less, and is treated as the lower value by if comparisons.Īs an illustration, from a cmd console, enter this and see what happens: if 12.10.0.0 leq 12.5.4.42 triggered! Comparing that against 12.5.4.42 in batch would trigger the install.

You don't want to trigger the install if the installed version is, for example, 12.10.0.0. More generally, when comparing version numbers, it'd be better to use a language that can objectify the version number and can understand. Variables in batch are surrounded by % when you want to evaluate them (or sometimes !). And as Magoo points out, Version is a string that will never equal 12.5.4.42. Temporarily remarking out off can help you find these simple syntax errors. One specific problem with your script is that you've got an extra & in this line: IF NOT Version=12.5.4.42 & goto install

Haven't dealt with FOR statements before. I feel like a tool that I can't get this figured out. Msiexec.exe /qn /norestart /i "%~dp0itunes.msi" Msiexec.exe /qn /norestart /i "%~dp0applemobiledevicesupport.msi" Msiexec.exe ALLUSERS=true reboot=suppress /qn /i "%~dp0appleapplicationsupport.msi" ::Installs the current version from the repository

::If the version is not equal to the number below IF Version=12.5.4.42 Up to date! & goto end How do I use the value from Version? Do I need to use a FOR loop for this? I have tried playing with it but not su ::If the version matches the number below iTunes is up to date REG QUERY "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes" /v Version I have looked around on Google a bit and can't find something that matches what I want to do. The issue I'm having is what is the best way to get the value from the registry key to my IF value. Trying to create a batch file that will check the iTunes version and then will update if the version is lower than the version listed in the script.
