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

  • Thanks, works great!
    This is a useful piece of software, have you thought about pushing it to github? 🙂

    I don't have experience with C++, but have looked at the code a bit and got a couple of ideas for improvement:

    • The configurable browser exe name is indeed a Very good idea. This way one single launcher can be used with all chromium-based browsers. No need to have one for Opera, another for Vivaldi, and third for Chrome.
    • Would be great to have the launcher_args file name taken from your launcher exe name, instead of being hardcoded as "launcher_args.txt". I mean, for example, if one downloads your launcher and renames it to "super-cool-launcher-from-hell.exe", it would read the args from "super-cool-launcher-from-hell.txt". One advantage of this approach is that it will be always clear that both files belong to the same software - your launcher. Another advantage is that both files will be one after another in the file manager (sorted by file name).
  • @agych said in Read Command-Line Arguments from a File on Startup:

    have you thought about pushing it to github?

    Not at the moment, but noted. I can release it under a license though so people can modify it etc. without worry.

    @agych said in Read Command-Line Arguments from a File on Startup:

    The configurable browser exe name is indeed a Very good idea.

    Indeed.

    I was thinking about doing just browser_launcher.exe and browser_launcher.cfg

    When I get a chance here soon.

  • @agych

    Okay, try browser_launcher to see how it works. You specify the exe to launch in the browser_launcher.cfg file. That way, it should work with whatever browser you want. It's not thoroughly tested yet, but I did test it with Opera a little bit.

  • @burnout426

    I've tried it properly this time, with RegisterFirefoxPortable and all the stuff, and got 2 issues:

    • When the browser_launcher is pinned to taskbar (by drag'n'dropping the browser_launcher or its shortcut) and is launched from there, Opera/Vivaldi are opened in a new taskbar "toast", instead of the place of the pinned launcher. In other words I get pinned icon in one place, and the opened browser in the end of the taskbar.
      I had to fix it by pinning the opened browsers (via taskbar), which resulted in the original browser executables being pinned, and then manually modifying each pinned shortcut so that they point to browser_launcher. So far it works, hope they will not disappear from the taskbar after reboot (sometimes it happens when the pinned shortcut was modified).

    • When browser_launcher is registered as a default program with RegisterFirefoxPortable and the .reg fix, it doesn't appear in "Default Programs" in control panel. Have no idea why...
      I have checked the registry and saw that RegisterFirefoxPortable did its job like it supposed to, so it is not this part that fails.
      I would assume that the original launcher has some sort of signature or something, "Default Programs" checks each registered default program if it is signed or not (while fetching the list of programs), and hides those that are not signed.
      I got it work by renaming browser_launcher.exe to whatever, renaming the original launcher to browser_launcher.exe, doing the RegisterFirefoxPortable procedure, and then renaming the launchers back. After that the browser entry is still in "Default Programs", opening web-files launches browser_launcher.exe, and the browser runs with all the arguments.

    After getting these two fixed, the launcher works great so far, I'm now using it with Opera and Vivaldi (both are standalone/portable).

    Did you have these issues?

  • @agych said in Read Command-Line Arguments from a File on Startup:

    When browser_launcher is registered as a default program with RegisterFirefoxPortable and the .reg fix, it doesn't appear in "Default Programs" in control panel. Have no idea why...

    I'll check this out. I only tested on Windows 10 -> Settings -> Apps -> Default Apps -> Web Browser. It's probably something to do with the Registered Applications key.

  • @agych said in Read Command-Line Arguments from a File on Startup:

    When the browser_launcher is pinned to taskbar (by drag'n'dropping the browser_launcher or its shortcut) and is launched from there, Opera/Vivaldi are opened in a new taskbar "toast", instead of the place of the pinned launcher. In other words I get pinned icon in one place, and the opened browser in the end of the taskbar.

    Yeah, after pinning browser_launcher.exe, whenever you click the icon, a separate icon is going to show up on the taskbar button for the browser as the browser is indeed another program. I'll see if there's a way around that besides your workaround.

  • Browser Chooser 2
    Open source. GitHub.

  • @rudrick Will check it out. Thanks

  • @rudrick said in Read Command-Line Arguments from a File on Startup:

    Browser Chooser 2

    I see it at https://bitbucket.org/gmyx/browserchooser2/wiki/Home, https://browserchooser2.com/ and https://archive.codeplex.com/?p=browserchooser2. I tried it. It has the option to add a custom exe and has an option to add Browser Chooser to Default Programs. But, I didn't find a way to auto-launch a particular browser when it's invoked from a file association etc. It always asks.

  • @burnout426 said in Read Command-Line Arguments from a File on Startup:

    I'll check this out. I only tested on Windows 10 -> Settings -> Apps -> Default Apps -> Web Browser. It's probably something to do with the Registered Applications key.

    Hmm, it's there under "Set default by apps" in Windows 10. It's under "Mozilla Firefox Portable Edition" or whatever. And, if I change ApplicationName in "HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\FirefoxPortable\Capabilities" to "Browser Launcher", it shows up as so in that list.

  • I put info (and the link) for my browser launcher on https://www.reddit.com/r/operabrowser/wiki/opera/browser_launcher. I'll just link to the latest version there from now on. The new upload linked there has a few, non-important improvements like a makefile, license, version info for the exe file, updated readme, and more examples in the cfg file.

    Would still like Opera to implement something like this in its launcher.exe. Would be much simpler that way. My browser launcher is example for the devs to go by.

Log in to reply