chrome-native-messaging

How to make Chrome native messaging host to start with an argument


I am currently trying to implement a communication between an exe native host program written by someone else, and my browser extension.

In manifest, when I specify path to host, everything is working just fine, but problem starts when I want to add an argument. The exe program requires this argument:

-Dconfig.file=test-application.conf

But when I put the argument into the manifest file like this:

"path": "C:\\..correct path.\\crypto-extension-host.exe -Dconfig.file=test-application.conf"

I get this warning in chrome log when I try to connect to the host

WARNING:native_process_launcher.cc(222)] Found manifest, but not the binary for native messaging host correct.name.host. Host path specified in the manifest: C:\..correct path.\crypto-extension-host.exe -Dconfig.file=test-application.conf

Is it even possible to start the application with argument? I wanted to create a bat file that would start the exe with argument, but it looks like when I start it using bat file, it's not communication using stdio like it should.

Any help please?


Solution

  • I made a bat file with this content:

    @echo off
    
    crypto-extension-host.exe -Dconfig.file=test-application.conf
    

    The important part is the @echo off

    I am now able to communicate with the bat program.