Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Read Command-Line Arguments from a File on Startup

  • You can already pass command-line arguments to launcher.exe directly in a command prompt or by modifying an Opera shortcut. The problem with this is that if Opera is launched by a file/protocol association where the command in the registry is used instead, Opera won't launch with those arguments. You could modify the registry commands for Opera to also contain the arguments you want, but those can get overwritten on you during update/install and default browser association.

    What would be great is for Opera's launcher.exe to support an args file next to it that it reads on startup and adds to the command-line arguments. The file format could be a simple text file or a json file. Whatever's easier.

    Posted this for Vivaldi also: https://forum.vivaldi.net/topic/26843/read-command-line-arguments-from-a-file-on-startup.

  • I figured something out.

    In the "Local State" file (in the profile folder), under the root object, you can (while Opera is closed) add (or edit if it's already there) a "browser" object and then an object under it named "flags". Under "flags" you create integer types with the names of the flags. For example:

    browser {
       "flags" : {
          "autoplay-policy" : 1,
          "save-page-as-mhtml" : -1
       }
    }
    

    It's a lot easier to do with JSONedit. It's even easier if you go to opera://flags first and set a flag so that the browser and flags objects are already there.

    Not all flags will be integer types though. Some may be strings. Integers seem to be used for just simple boolean flags too.

    It might not work for all command-line settings though. Maybe it only works for ones listed in opera://flags. For example, this one doesn't seem to work as an on/off like it does when you just pass it to launcher.exe. It may work as a string when you specify IDs to extensions though.

    If it doesn't work for all commands, then it'd still be nice that it did.