各位前輩好
我目前在處理VANS派送更新或移除舊版軟體的時候卡關
有不少人的chrome雖然更新到最新了,
但chrome的擴充套件超級舊甚至已經不支援了,
因數量有點多,
希望透過派送的方式進行遠端背景刪除,
只是不論使用預設移除指令或是我批次檔都無法成功移除,
不知我的批次檔要怎麼改寫比較好?
軟體名稱: gmail
軟體商:Google\Chrome
移除指令:"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 9" --uninstall-app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm
我的批次檔如下
@echo off
REM Set the extension ID to be removed
SET EXTENSION_ID=fmgjjmmmlfnkbppncabfkddbjimcfncm
REM Set the Chrome user data directory path
SET "USER_DATA_DIR=%LOCALAPPDATA%\Google\Chrome\User Data"
REM check chrome path
IF EXIST "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" (
SET "CHROME_PATH=C:\Program Files (x86)\Google\Chrome\Application\"
) ELSE (
SET "CHROME_PATH=C:\Program Files\Google\Chrome\Application\"
)
REM Close all Chrome processes
taskkill /IM chrome.exe /F
REM Pause for a few seconds to ensure all processes are closed
timeout /t 1 /nobreak
REM Iterate through all profile folders and remove the extension
FOR /D %%p IN ("%USER_DATA_DIR%\*") DO (
IF EXIST "%%p\Extensions\%EXTENSION_ID%" (
echo Do %%p ...
echo remove app
REM 因應會跳出chrome選擇使用者畫面就卡住,所以要kill掉chrome
start cmd /c "%CHROME_PATH%"chrome.exe --profile-directory="%%p" --uninstall-app-id=%EXTENSION_ID%
timeout /t 1 /nobreak
taskkill /IM chrome.exe /F
echo del fielder
rmdir /s /q "%%p\Extensions\%EXTENSION_ID%"
IF EXIST "%%p\Extensions\%EXTENSION_ID%" (
echo del fail
) ELSE (
echo ok
)
)
)
echo Extension %EXTENSION_ID% has been removed from all profiles.
pause
測試中途有猜測是否是登錄檔問題,
但是砍了還是一樣
換不同瀏覽器使用相同關鍵字查詢google,結果竟然完全不同...
chrome --profile-directory=XXX --uninstall-app-id=XXX
,因為一定會跳提示框問使用者是否要移除--profile-directory=名稱,有反應
"C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory=Default --uninstall-app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm
"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\Users\user\AppData\Local\Google\Chrome\User Data" --profile-directory=Default --uninstall-app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm
--profile-directory=完整路徑,沒有反應
"C:\Program Files\Google\Chrome\Application\chrome.exe" --profile-directory="C:\Users\user\AppData\Local\Google\Chrome\User Data\Default" --uninstall-app-id=fmgjjmmmlfnkbppncabfkddbjimcfncm
要移除「gmail」嗎?
要加@
避免cmd移除雙引號
start cmd /c @"%CHROME_PATH%"chrome.exe
@Wordle Unlimited Chrome versions after 36 require different approaches. You can consider using the Chrome Management Console for enterprise environments or explore developing a custom Chrome extension for programmatic removal.