我正在使用以下bat文件将我的应用程序安装到用户计算机上。但是,如果应用程序已安装,则客户端希望能够卸载应用程序,然后安装新版本的应用程序。bat文件来卸载已安装的应用程序
但是,我有2个问题。
1)如何检测应用程序是否安装?
2)如果安装了,我该如何卸载它?
应用程序是一个C#2005
@ECHO OFF
:: Copy the configuration file
copy config.xml "%AppData%\DataLinks.xml"
:: Search for the CONFIG file, if this doesn't exit then the user doesn't have the .Net framework 2.0
SET FileName=%windir%\Microsoft.NET\Framework\v2.0.50727\CONFIG
IF EXIST %FileName% GOTO INSTALL_DIALER
ECHO.You currently do not have the Microsoft(c) .NET Framework 2.0 installed.
ECHO.This is required by the setup program for CAT Dialer
ECHO.
ECHO.The Microsoft(c) .NET Framework 2.0 will now be installed on you system.
ECHO.After completion setup will continue to install CAT Dialer on your system.
ECHO.
:: Install the .Net framework and then run setup to install the CAT Dialerr
PAUSE
ECHO Installing... this could take several minutes...Please wait....
START /WAIT NetFx20SP2_x86.exe
:: If the user cancels the installation of the framework exit batch file
IF errorlevel 1 GOTO EOF
Start CATSoftphone.exe
ECHO ON
EXIT
:: .Net framework has been skipped contine to install the dialer.
:INSTALL_DIALER
ECHO *** Skiped Dotnet Framework 2.0.50727 ***
ECHO Installing... Please wait...
START CATSoftphone.exe
ECHO ON
EXIT
编辑==============================
<job id="ReInstall">
<script language="VBScript">
Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
oExec = WshShell.Run("msiexec /uninstall {2E92DD55-37E9-4D6C-B55B-DAFD9DF583E2}" , 1 , true)
If oExec = 0 OR oExec = 1605 Then
oExec = WshShell.Run("InstallUninstallBat.msi")
End If
</script>
</job>
您好,我测试了您的脚本文件,并添加了我自己的productcode和msi名称。但是,当我运行它只是快速闪烁,并没有做任何事情。我错过了什么。我用我的脚本编辑了我的代码。谢谢。 – ant2009 2009-07-02 17:32:57