我想从计算机上卸载几个程序(Windows 7 64位)。
是否有批处理\脚本可以帮助我这样做?或者我需要从控制面板逐个进行?
如果没有Windows 7,那么在XP中是否有这样的东西?
感谢, DOR。
答案 0 :(得分:12)
我知道在cmd中确实没有uninstall
命令。但是,您可以查询此注册表项
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
(如果您使用的是64位计算机,可能还需要检查HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
)
找到要卸载的程序。每个都有一个UninstallString
值,它会告诉你程序卸载程序文件的路径,然后你可以通过调用它的完整路径和文件名来执行它。
如果卸载程序恰好是msi,则可以使用
msiexec /uninstall /x
以静默方式卸载它。这与我认为批次一样多。
希望这有帮助!
答案 1 :(得分:10)
补充巴厘岛的答案,请尝试以下代码......
@echo off
for /f "tokens=*" %%a in ('reg query hklm\software\Microsoft\Windows\CurrentVersion\Uninstall\ ^| find /I "%*"') do (
for /f "tokens=1,2,*" %%b in ('reg query "%%a" /v UninstallString ^| find /I "UninstallString"') do (
if /i %%b==UninstallString (
echo %%d
)
)
)
仔细测试。然后删除echo
命令。
答案 2 :(得分:4)
我今天早上写了这个。
@Echo off
Echo This is a batch file uninstallation program.
Echo Run as administrator WMIC will not work.
echo.
Echo The command [wmic product get name] will run.
Echo Looking up all installed programs...
echo.
wmic product get name
echo 1. First program
echo 2. Second program
echo 3. Third program
echo 4. Fourth program
echo 5. Fifth program
echo.
@echo Pick a number:
echo.
choice /c:12345
if "%errorlevel%"=="1" wmic product where name="First program" call uninstall
if "%errorlevel%"=="2" wmic product where name="Second program" call uninstall
if "%errorlevel%"=="3" wmic product where name="Third program" call uninstall
if "%errorlevel%"=="4" wmic product where name="Fourth program" call uninstall
if "%errorlevel%"=="5" wmic product where name="Fifth program" call uninstall
Echo.
Echo.
@echo First method is done. I'll go into the alternate method.
pause
Echo Get user input - program name?
Echo.
Echo This is an alternate method
:input
set INPUT=
set /P INPUT=Uninstall which program?: %=%
if "%INPUT%"=="" goto input
echo Your input was: %INPUT%
echo.
echo.
Echo Uninstalling...
echo The command [wmic product where name="%INPUT%" call uninstall] will run.
wmic product where name="%INPUT%" call uninstall
@echo If there is "no instance" errors, then the program %INPUT% was uninstalled.
pause
答案 3 :(得分:2)
从终端使用wmic。您可以查看microsoft的文档以查看更多用法。
这将是一个很好的起点:
wmic product where vendor="Autodesk" call uninstall
我使用上面的行清除卸载的autodesk产品。
答案 4 :(得分:0)
如果您不需要将其作为(命令行)批处理,那么BCUninstaller非常适合在Windows中一次性删除和清理许多污水:https://sourceforge.net/projects/bulk-crap-uninstaller/