22

Is it possible to load and unload unpacked Chrome extensions from the Command Line?

Cœur
  • 37,241
  • 25
  • 195
  • 267
wildeyes
  • 6,767
  • 5
  • 19
  • 37

5 Answers5

34

Yes, although only temporarily *:

chromium --load-extension=path/to/extension

If you want to load multiple extensions, just separate the path by a comma:

chromium --load-extension=path/to/extension,path/to/another/extension

Replace chromium with chrome.exe (or whatever is used to start your Chrome/Chromium browser).

* When you close the browser, and starts it again without the command line argument, then the extension will disappear from the list of installed extensions.

Rob W
  • 341,306
  • 83
  • 791
  • 678
5

It is possible to install using --load-and-launch-app=path/to/app

it is working for both apps and extensions. (I tested on chrome Version 35.0.1916.153 m)

I am not sure that there is another command for uninstalling. I found this list of chromium commands which is very useful.

Ruwanka De Silva
  • 3,555
  • 6
  • 35
  • 51
  • This flag does not permanently install an app or extension. Once the flag is removed, the extension/app is gone as well. `--load-and-launch-app` and `--load-extension` should both [work as expected](http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/unpacked_installer.h?revision=282250&view=markup#l44). I think that you had at least one Chrome window open when you tried to use the `--load-extension` flag. These flags are only functional if Chrome is completely shut down. – Rob W Jul 11 '14 at 08:44
  • Are you sure about that? I just close all windows of chrome and run that command then extension is loaded. Then i close chrome and launch it again. Extension is there. Any how i don't know the reason. – Ruwanka De Silva Jul 11 '14 at 09:12
  • 1
    Open the task manager and check for any open chrome.exe processes. – Rob W Jul 11 '14 at 09:15
  • I did after you told that, ya there were chrome.exe processes, is it the reson? I kill all processes and launch chrome again, still there is extension installed from above command. – Ruwanka De Silva Jul 11 '14 at 09:37
  • Kill all processes, and start chrome.exe without these command line flags. Then the extension/app will not be installed. If it is installed, then you have probably loaded the extension as an unpacked extension before via the "Load unpacked extension" button at `chrome://extensions` in developer mode. – Rob W Jul 11 '14 at 09:39
  • You are right, I used that command for install unpacked extension, and developer mode is on. i think that is the case. I followed your steps after removing previously installed extension but i am getting same result. Any how i'll change answer. thanks – Ruwanka De Silva Jul 11 '14 at 09:47
  • --load-and-launch-app works also while chrome is running and even better it doesn't even open a chrome window afterwards if you loaded an extension .. perfect for automation during extension development – ntziolis Jul 22 '16 at 09:41
  • no longer works in chrome 79 / chromium 79. Received an error message asking me to use `--load-extension=` instead – xypha Dec 19 '19 at 02:40
5

3 ways install/use Chrome extensions offline:


Method A: Drag & Drop (Simple)

  • Drag & drop ABP.crx on: chrome://extensions to install

Pros: Installs web & non-westore extensions

Cons: Google quickly & permanently disables non-webstore extensions


Method B: Load unzipped extension/7zip to unzip/ABP used as example

  • UnZip ABP.crx: C:\ABP
  • Load 1: Shortcut: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --load-extension="C:\ABP"
  • Load 2: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --load-extension="C:\ABP,C:\IEtab"

Pros: Permanently enables non-webstore extensions, so long as your using custom shortcut

Cons: Extensions only load via custom shortcut

~~~~~~~~~~~~~~~ 3 fixes for extracted extension errors: ~~~~~~~~~~~~~~~

  • Won't load: Create shortcut to folder containing manifest file, for example: akkmfdhlogbapbcgojknhfgppcionopk\5.4.7_0

  • Metadata: Extension\delete _metadata folder

  • Disabled: Open manifest.json with notepad & locate:

"name": "MSG_appName",

"offline_enabled": true,

Create: "offline_enabled": true, if it doesn't exist


Method C: WinRar SFX (Mass install local/non-local profile apps)

Chrome extracts all plugins to: %LocalAppData%\Google\User Data\Default\Extensions

Extensions list by web-store ID. Example: ABP=cfhdojbkjhnklbpkdaibdccddilifddb

ABP needs 3 files: Some extensions may only require 2

  • Install all plugins needed, remove all not needed. Exit Chrome.
  • Backup: %LocalAppData%\Google to: C:\Backup\Google
  • Copy: %LocalAppData%\Google\Chrome\User Data\Default\Extensions to: C:\Google\Chrome\User Data\Default\Extensions
  • Copy: %LocalAppData%\Google\Chrome\User Data\Default\secure preferences to: C:\Google\Chrome\User Data\Default\secure preferences
  • Copy: %LocalAppData%\Google\Chrome\User Data\Default\Local Extension Settings to: C:\Google\Chrome\User Data\Default\Local Extension Settings
  • Create WinRar SFX: Extract C:\Google to: %LocalAppData%\Google

(ABP stores settings: %LocalAppData%\Google\User Data\Default\Local Extension Settings)

Pros: Mass install web & non-webstore apps, from local/nonlocal pc's

Cons: Google quickly & permanently disables non-webstore extensions

When SFX imports secure preferences file, it replaces old extensions/settings with imported

Restore Chrome Backup:

  • Exit Chrome & delete %LocalAppData%\Google\Chrome
  • Copy C:\Backup\Google to: %LocalAppData%\Google
  • Launch Chrome
James
  • 51
  • 1
  • 2
0

Try to kill all existing instances of Chrome from task manager : TASKKILL /IM chrome.exe /F and then chrome.exe --load-extension=path/to/extension should work

This working C# code for console application can help

class Program
    {
        static void Main(string[] args)
        {
            Process cmd = new Process();

            cmd.StartInfo.FileName = "cmd.exe";
            cmd.StartInfo.RedirectStandardInput = true;
            cmd.StartInfo.RedirectStandardOutput = true;
            cmd.StartInfo.CreateNoWindow = true;
            cmd.StartInfo.UseShellExecute = false;

            cmd.Start();
            //kill all chrome instances
            cmd.StandardInput.WriteLine("TASKKILL /IM chrome.exe /F");
            //path to chrome.exe
            cmd.StandardInput.WriteLine("cd C:\\Program Files (x86)\\Google\\Chrome\\Application");
            //load extension
            cmd.StandardInput.WriteLine("chrome.exe --load-extension={path-to-extension}");

            cmd.StandardInput.Flush();
            cmd.StandardInput.Close();
            Console.WriteLine(cmd.StandardOutput.ReadToEnd());

        }
    }
Mihuilk
  • 1,901
  • 1
  • 22
  • 17
0

I took the previous answers and got the perfect script for me on mac.

I want just to share with you

open -a chromium --args --load-extension=$PWD/build --force-dev-mode-highlighting --no-default-browser-check
Pablo
  • 65
  • 8