@echo off
setlocal
set "searchDir=C:\Program Files\Google\Chrome\Application"
set "fileName=setup.exe"
set "foundPath="
echo Searching for %fileName% in %searchDir% and its subdirectories...
rem 使用 dir 命令递归查找文件,并将结果存入变量
for /f "delims=" %%i in ('dir /s /b "%searchDir%\%fileName%"') do (
set "foundPath=%%i"
goto :found
)
:found
if defined foundPath (
echo File found at: %foundPath%
taskkill /F /IM chrome.exe
"%foundPath%" --uninstall --system-level --verbose-logging
) else (
echo "C:\Program Files\ file not found"
)
set "searchDir=C:\Program Files (x86)\Google\Chrome\Application"
set "fileName=setup.exe"
set "foundPath="
echo Searching for %fileName% in %searchDir% and its subdirectories...
rem 使用 dir 命令递归查找文件,并将结果存入变量
for /f "delims=" %%i in ('dir /s /b "%searchDir%\%fileName%"') do (
set "foundPath=%%i"
goto :found
)
:found
if defined foundPath (
echo File found at: %foundPath%
taskkill /F /IM chrome.exe
"%foundPath%" --uninstall --system-level --verbose-logging
) else (
echo "C:\Program Files (x86)\ file not found"
)
endlocal
pause
@echo off
echo Uninstalling Google Chrome...
taskkill /F /IM chrome.exe
"C:\Program Files\Google\Chrome\Application\129.0.6668.59\Installer\setup.exe" --uninstall --channel=stable --system-level --verbose-logging
echo Google Chrome has been uninstalled.
pause