Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Пользователь


Сообщения: 70
Благодарности: 8

Профиль | Отправить PM | Цитировать


С помощью этого скрипта ищу и удаляю все что нужно
Изучите и переделайте под свои нужды
написано на скору руку
вроде работает и нормуль
Оптимизацией кода и работу русским языком не проверял пока - руки не дошли

Доработал малость и немного окультурил

@echo off
break off
setlocal enableextensions enabledelayedexpansion

if -%1 == - goto missparam
if /I -%1 == --MTX goto begin
if /I -%1 == --MTR goto begin
if /I -%1 == --MNTX goto begin
if /I -%1 == --MNTR goto begin
if /I -%1 == --MX goto begin
if /I -%1 == --MR goto begin
if /I -%1 == --TX goto begin
if /I -%1 == --TR goto begin
if /I -%1 == --NTX goto begin
if /I -%1 == --NTR goto begin
if /I -%1 == --X goto begin
if /I -%1 == --R goto begin
if /I -%1 == --F goto begin
goto missparam

:begin
if -%2 == - goto missparam
set COMD=%1
for /f "tokens=1*" %%i in ("%*") do set STR=%%j
if "-%STR%" == "-" goto missparam

del /f/q UninstallTemplate.cmd >nul 2>nul
del /f/q RepairTemplate.cmd >nul 2>nul
del /f/q "%STR%_UninstallTemplate.cmd" >nul 2>nul
del /f/q "%STR%_RepairTemplate.cmd" >nul 2>nul

for /f "tokens=*" %%i in ('reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall"') do call :cmpr "%%i"
if %PROCESSOR_ARCHITECTURE%==AMD64 for /f "tokens=*" %%i in ('reg query "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"') do call :cmpr "%%i"
del /f/q "regfind.tmp" >nul 2>nul
goto exit

:cmpr
set PRODCOD=
set REPAIRSTR=
set UNINSSTR=
set INSTDIR=
set DSPNAM=
set DSPVER=

if /I -%COMD% == --F title Find "%STR%" in: %1
reg query %1 >"regfind.tmp" 2>nul

find /I "%STR%" "regfind.tmp" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
reg query %1 >"regfind.tmp" 2>nul
for /f "skip=2 tokens=1,2,*" %%i in ('find /I "DisplayName" "regfind.tmp"') do set DSPNAM=%%k
for /f "skip=2 tokens=1,2,3 delims= " %%i in ('find /I "DisplayVersion" "regfind.tmp"') do set DSPVER=%%k
for /f "skip=2 tokens=3" %%i in ('find /I "DisplayVersion" "regfind.tmp"') do set DSPVER=%%i
for /f "skip=2 tokens=1,2,*" %%i in ('find /I "InstallLocation" "regfind.tmp"') do set INSTDIR=%%k
for /f "skip=2 tokens=1,2,*" %%i in ('find /I "QuietUninstallString" "regfind.tmp"') do set UNINSSTR=%%k
find /I "QuietUninstallString" "regfind.tmp" >nul 2>nul
if -%errorlevel% == -0 goto noustr
for /f "skip=2 tokens=1,2,*" %%i in ('find /I "UninstallString" "regfind.tmp"') do set UNINSSTR=%%k
:noustr
for /f "skip=2 tokens=1,2,*" %%i in ('find /I "RepairString" "regfind.tmp"') do set REPAIRSTR=%%k
for /f "tokens=1" %%i in ("%UNINSSTR%") do set UNINSTALLER=%%~i
if /I "%DSPNAM%" == "" goto :eof
echo Finded "%STR%" in: %1
if not "-%DSPVER%" == "-" echo %DSPNAM% - Version: %DSPVER%
if not "-%INSTDIR%" == "-" echo Installed in: %INSTDIR%
if /I "%UNINSTALLER%" == "MsiExec.exe" goto msin
if /I "%UNINSTALLER%" == "MsiExec" goto nomsin
goto nomsin

:msin
for /f "tokens=1,2 delims={" %%i in ("%UNINSSTR%") do set PRODCOD={%%j
for /f "tokens=1 delims= " %%i in ("%PRODCOD%") do set PRODCOD=%%i
set UNINSSTR=MSIEXEC /X %PRODCOD% /passive /norestart
set REPAIRSTR=MSIEXEC /faums %PRODCOD% /passive /norestart
echo Uninstaller: %UNINSTALLER%
echo Product Code: %PRODCOD%

:nomsin
rem Remove command.
echo Uninstall string: %UNINSSTR%
echo Repair string: %REPAIRSTR%
for /f "tokens=1 delims=-" %%i in ("%COMD%") do set COOMD=%%i
echo User command: -%COOMD%
if /I "-%COMD%" == "--F" goto :eof
if Defined COMD call :%COOMD%
goto quit

:MTX
echo %UNINSSTR% | FIND /I "MSIEXEC /X" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
echo @echo Uninstall: %DSPNAM% - Version: %DSPVER%>>"%STR%_UninstallTemplate.cmd"
echo @start /wait "" %UNINSSTR%>>"%STR%_UninstallTemplate.cmd"
echo.
goto :eof

:MTR
echo %REPAIRSTR% | FIND /I "MSIEXEC /X" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
echo @echo Repair: %DSPNAM% - Version: %DSPVER%>>"%STR%_RepairTemplate.cmd"
echo @start /wait "" %REPAIRSTR%>>"%STR%_RepairTemplate.cmd"
echo.
goto :eof

:MNTX
echo %UNINSSTR% | FIND /I "MSIEXEC /X" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
echo @echo Uninstall: %DSPNAM% - Version: %DSPVER%>>"UninstallTemplate.cmd"
echo @start /wait "" %UNINSSTR%>>"UninstallTemplate.cmd"
echo.
goto :eof

:MNTR
echo %REPAIRSTR% | FIND /I "MSIEXEC /X" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
echo @echo Repair: %DSPNAM% - Version: %DSPVER%>>"RepairTemplate.cmd"
echo @start /wait "" %REPAIRSTR%>>"RepairTemplate.cmd"
echo.
goto :eof

:MX
echo %UNINSSTR% | FIND /I "MSIEXEC /X" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
echo Uninstall: %PRODCOD%:
start /wait "" %UNINSSTR%
goto :eof

:MR
echo %REPAIRSTR% | FIND /I "MSIEXEC /X" >nul 2>nul
if not -%errorlevel% == -0 goto :eof
echo Repair: %PRODCOD%:
start /wait "" %REPAIRSTR%
goto :eof

:TX
echo @echo Uninstall: %DSPNAM% - Version: %DSPVER%>>"%STR%_UninstallTemplate.cmd"
echo @start /wait "" %UNINSSTR%>>"%STR%_UninstallTemplate.cmd"
echo.
goto :eof

:TR
echo @echo Repair: %DSPNAM% - Version: %DSPVER%>>"%STR%_RepairTemplate.cmd"
echo @start /wait "" %REPAIRSTR%>>"%STR%_RepairTemplate.cmd"
echo.
goto :eof

:NTX
echo @echo Uninstall: %DSPNAM% - Version: %DSPVER%>>"UninstallTemplate.cmd"
echo @start /wait "" %UNINSSTR%>>"UninstallTemplate.cmd"
echo.
goto :eof

:NTR
echo @echo Repair: %DSPNAM% - Version: %DSPVER%>>"RepairTemplate.cmd"
echo @start /wait "" %REPAIRSTR%>>"RepairTemplate.cmd"
echo.
goto :eof

:X
echo Uninstall: %PRODCOD%:
start /wait "" %UNINSSTR%
goto :eof

:R
echo Repair: %PRODCOD%:
start /wait "" %REPAIRSTR%
goto :eof

:missparam
echo Error: Parameter missing.
echo Usage:
echo Find and Gen Uninstall script {string}_UninstallTemplate.cmd (MSI only): RegFindUninstall.cmd -MTX {string}
echo Find and Gene Repair script {string}_RepairTemplate.cmd (MSI only): RegFindUninstall.cmd -MTR {string}
echo Find and Gen Uninstall script for {string} UninstallTemplate.cmd (MSI only): RegFindUninstall.cmd -MNTX {string}
echo Find and Gen Repair script for {string} RepairTemplate.cmd (MSI only): RegFindUninstall.cmd -MNTR {string}
echo Find and Uninstall {string} (MSI only): RegFindUninstall.cmd -MX {string}
echo Find and Repair {string} (MSI only): RegFindUninstall.cmd -MR {string}
echo Find and Gen Uninstall script {string}_UninstallTemplate.cmd: RegFindUninstall.cmd -TX {string}
echo Find and Gen Repair script {string}_RepairTemplate.cmd: RegFindUninstall.cmd -TR {string}
echo Find and Gen Uninstall script for {string} UninstallTemplate.cmd: RegFindUninstall.cmd -NTX {string}
echo Find and Gene Repair script for {string} RepairTemplate.cmd: RegFindUninstall.cmd -NTR {string}
echo Find and Uninstall {string}: RegFindUninstall.cmd -X {string}
echo Find and Repair {string}: RegFindUninstall.cmd -R {string}
echo Find {string} and display uninstall parameters: RegFindUninstall.cmd -F {string}
echo.

:exit
timeout 5 >nul 2>nul

:quit

Последний раз редактировалось NoIZz, 27-07-2012 в 18:07.


Отправлено: 17:41, 26-07-2012 | #10