1

我需要使用本机安装程序自动静默更新空中应用程序,所以我制作了这个批处理文件:

IF EXIST "%PROGRAMFILES(X86)%" (
taskkill /IM Application.exe
taskkill /IM adl.exe
wmic product where name="Application" call uninstall /nointeractive
"%HOMEPATH%\AppData\Roaming\com.application\Local Store\Application.exe" -silent -eulaAccepted -location "\%PROGRAMFILES(x86)%\" -desktopShortcut
"%PROGRAMFILES(x86)%\Applicaion\Application.exe"
taskkill /F /IM cmd.exe 
) ELSE (
taskkill /IM Application.exe 
taskkill /IM adl.exe
wmic product where name="Application" call uninstall /nointeractive
"%HOMEPATH%\AppData\Roaming\com.Application\Local Store\Application.exe" -silent -eulaAccepted -location "\%PROGRAMFILES%\" -desktopShortcut
"%PROGRAMFILES%\Application\Application.exe"
taskkill /F /IM cmd.exe ) 

我在 64 位 Windows 上测试它,所以 %PROGRAMFILES(x86)%" 确实存在,它卸载了软件,但没有安装新软件,它在 32 位 Windows 上根本不起作用

4

1 回答 1

2
@ECHO OFF &SETLOCAL
IF DEFINED PROGRAMFILES(X86) (SET "PROGRAMFOLDER=%PROGRAMFILES(X86)%") ELSE SET "PROGRAMFOLDER=%PROGRAMFILES%"
taskkill /IM Application.exe
taskkill /IM adl.exe
wmic product where name="Application" call uninstall /nointeractive
"%HOMEPATH%\AppData\Roaming\com.application\Local Store\Application.exe" -silent -eulaAccepted -location "\%PROGRAMFOLDER%\" -desktopShortcut
"%PROGRAMFOLDER%\Application\Application.exe"
taskkill /F /IM cmd.exe 
于 2013-10-14T12:44:52.447 回答