2013-08-26 173 views
2

我需要一些帮助来完成以下工作。它之前(与其他软件)一起工作,但在Flash的情况下,它不是。我试图完成的是检查安装的Flash版本。如果安装的Flash版本不是我想要的,我希望脚本卸载当前版本并安装我所需的版本。检查Flash版本的脚本没有真正检查版本

:: Check Flash version and install if not matching. 

:: Set version to check for. 

SET latestVersion=11.5.502.135 
SET key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe Flash Player Plugin" 

for /f "tokens=3 delims= " %%G in ('reg query %key% /v DisplayVersion ^| findstr /i current') do (
echo %%G 
if %%G EQU %latestVersion% goto END 
if %%G NEQ %latestVersion% goto Install 
) 

:INSTALL 
:: Kill IE & FF 
taskkill /f /im iexplore.exe /im firefox.exe 

::Uninstall Flash 
\\path-to-server\Flash-FF-11.8.800.94.exe -uninstall 

:: Install Flash for Firefox 
\\path-to-server\Flash-FF-11.5.502.135.exe -install 

:: Install Flash for IE 
\\path-to-server\Flash-IE-11.5.502.135.exe -install 

:: Kill Flash updating 
COPY /y \\path-to-server\mms.cfg C:\WINDOWS\System32\Macromed\Flash\mms.cfg 

:END 

问题是它没有读取安装的版本。它不是回显11.5.502.135之类的东西,而是回应“%G”。而且由于%G不等于我想要的版本(11.5.502.135),所以每次都安装它。

因此缩小了下去,下面是我的问题:

for /f "tokens=3 delims= " %%G in ('reg query %key% /v DisplayVersion ^| findstr /i current') do (
echo %%G 
if %%G EQU %latestVersion% goto END 
if %%G NEQ %latestVersion% goto Install 
) 

当手动键入它,只要我停在“DisplayVersion”我知道我正在寻找的信息。但是一旦我进入()内部的最后部分,那就是当我得到错误时。

+0

你的*闪光灯对于其他浏览器检查*? – fauverism

回答

2
for /f "tokens=2*" %%a in ('reg query "HKEY_CURRENT_USER\Software\Macromedia\FlashPlayerUpdate" /v version') DO SET "FlashVersion=%%b" 
echo %FlashVersion% 
+0

工作正常!我不得不将注册表项更改为“HKEY_LOCAL_MACHINE \ Software \ Macromedia \ FlashPlayerPlugin”,但是一旦我确实做到了,一切正常。非常感谢! – Josh

0

要检查此计算机上安装的Adobe Flash Player您的当前版本中,你应该执行这样的批处理文件:

@echo off 
for /f "tokens=2*" %%a in (
'reg query "HKEY_LOCAL_MACHINE\Software\Macromedia\FlashPlayerPlugin" /v version' 
) DO SET "FlashVersion=%%b" 
echo Current Flash Player Version Installed is : "%FlashVersion%" on this computer %ComputerName% 
pause 

编辑

有人会遇到这样的错误(con nection失败或应用程序初始化错误),而他想从他们的在线安装程序安装Flash播放器时,这发生在我身上,因此,我决定通过下载卸载程序并卸载所有以前的版本并下载来创建批处理文件以修复此类错误最新的带有完整安装的Adobe Flash Player(脱机安装程序),并在后台以静默方式安装。

enter image description here

Download_Install_Latest_Flash_Player.bat

enter image description here