批处理文件以卸载程序 [英] Batch file to uninstall a program

查看:871
本文介绍了批处理文件以卸载程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过批处理文件卸载程序EXE,但没有成功.

I'm trying to uninstall a program EXE via batch file and am not having any success.

在注册表中找到的卸载字符串如下:

The uninstall string found in the registry is as follows:

C:\PROGRA~1\Kofax\Capture\ACUnInst.exe /Workstation
C:\PROGRA~1\Kofax\Capture\UNWISE.EXE /U 
C:\PROGRA~1\Kofax\Capture\INSTALL.LOG

如果我从CMD或批处理中运行该命令,则无济于事.

If I run that from CMD or batch it does nothing.

如果我从CMD运行C:\PROGRA~1\Kofax\Capture\UNWISE.EXE /U,它将打开一个对话框,指向INSTALL.LOG文件,然后继续卸载.

If I run C:\PROGRA~1\Kofax\Capture\UNWISE.EXE /U from CMD it will open up a dialog box to point to the INSTALL.LOG file and then proceed to uninstall.

最后,它会要求我单击完成".

At the end, it will ask me to click finish.

我需要保持沉默,您能指出我正确的方向吗?这是在XP和7上.

I need this to be silent, can you point me in the right direction? This is on XP and 7.

推荐答案

每个根据Microsoft指南正确安装的程序都会在HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall(对于计算机安装)或HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall(对于用户配置文件安装)中生成注册表项).通常,程序的密钥将是其GUID或程序的名称.在该键内将有一个名为UninstallString的条目.这包含执行以卸载程序的命令.

Every program that properly installs itself according to Microsoft's guidelines makes a registry entry in either HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall (for machine installs) or HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall (for user profile installs). Usually, the key for the program will be its GUID, or else the name of the program. Within that key will be an entry called UninstallString. This contains the command to execute to uninstall the program.

如果您已经提前知道要卸载的内容,只需将其放入批处理文件中就足够了.但是,当您尝试使该过程自动化时,它将变得很棘手.您可以使用reg命令从注册表中获取数据,但是它会在给定键的实际值附近返回很多文本,从而使其难以使用.您可能想尝试使用VBscript或PowerShell,因为它们具有更好的选择,可以将数据从注册表中获取到变量中.

If you already know ahead of time what you will be uninstalling, it should be easy enough to just put that in your batch file. It gets tricky when you try to automate that process though. You can use the reg command to get data from the registry, but it returns a lot of text around the actual value of a given key, making it hard to use. You may want to experiment with using VBscript or PowerShell, as they have better options for getting data from the registry into a variable.

这可能会进一步帮助您.....

This might help you further.....

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆