【发布时间】:2017-05-20 10:24:48
【问题描述】:
尝试创建一个批处理文件来检查 iTunes 版本,如果版本低于脚本中列出的版本,则会更新。
我遇到的问题是将值从注册表项获取到我的 IF 值的最佳方法是什么。
我在 Google 上环顾了一下,找不到与我想做的事情相匹配的东西。
::Finds the value of the Version key
REG QUERY "HKLM\SOFTWARE\Apple Computer, Inc.\iTunes" /v Version
这就是我卡住的地方。如何使用版本中的值?我需要为此使用 FOR 循环吗?我试过玩它,但不是 su
::If the version matches the number below iTunes is up to date
IF Version==12.5.4.42 @echo Up to date! && goto end
::If the version is not equal to the number below
IF NOT Version==12.5.4.42 && goto install
::Installs the current version from the repository
:install
msiexec.exe ALLUSERS=true reboot=suppress /qn /i "%~dp0appleapplicationsupport.msi"
msiexec.exe /qn /norestart /i "%~dp0applemobiledevicesupport.msi"
msiexec.exe /qn /norestart /i "%~dp0itunes.msi"
echo Cleaning Up Installation
del C:\Users\Public\Desktop\iTunes.lnk
:end
exit
我觉得自己是一个无法解决这个问题的工具。之前没有处理过 FOR 语句。提前为我的愚蠢道歉。
【问题讨论】:
标签: batch-file installation registry itunes