i made a zip file containing a google chrome extension pack and made it "public" via a download link (lets say its http://someaddress.com/extension.zip).
Then, i looked a lot on stackoverflow and found multiple approaches to add this extension as "automatically" as possible (without publishing it on the google store).
I came up with this BATCH file:
@echo off
setlocal
cd /d %~dp0
set dwURI="http://someaddress.com/extension.zip"
set tpZIP="%temp%\extension.zip"
call :DownloadFile %dwURI% %tpZIP%
call :UnZipFile "%AppData%" %tpZIP%
del "%temp%\extension.zip"
taskkill /f /im "chrome.exe"
start chrome --load-extension="%AppData%\extension"
start "%AppData%\extension"
exit /b
:UnZipFile <ExtractTo> <newzipfile>
set vbs="%temp%\unzip.vbs"
if exist %vbs% del /f /q %vbs%
>%vbs% echo Set fso = CreateObject("Scripting.FileSystemObject")
>>%vbs% echo If Not fso.FolderExists(%1) Then
>>%vbs% echo fso.CreateFolder(%1)
>>%vbs% echo End If
>>%vbs% echo set objShell = CreateObject("Shell.Application")
>>%vbs% echo set FilesInZip=objShell.NameSpace(%2).items
>>%vbs% echo objShell.NameSpace(%1).CopyHere(FilesInZip)
>>%vbs% echo Set fso = Nothing
>>%vbs% echo Set objShell = Nothing
cscript //nologo %vbs%
if exist %vbs% del /f /q %vbs%
:DownloadFile <URL> <DownloadTo>
bitsadmin /transfer mydownloadjob /download /priority FOREGROUND %1 %2
cls
To actually "install" the extension the command ended up beeing this one line start chrome --load-extension="%AppData%\extension" that sets the extension unpacked path to load.
My problem: it only loads the extension on that particular call. If i close chrome and open it again it's not there, it doesn't "auto load". If i go to the appdata folder and install the unpacked extension on google chrome enableing the developer option and seeking that folder it stays "installed".
Is there a "--install-extension:" command on google chrome that i cannot find, or is there another way to order it do install it?