I have a chrome extension that communicates with a native messaging host to get some data.
The issue is, when I launch the Chrome browser via the shortcut or via the pinned shortcut in the taskbar, the extension is not able to connect to the host. I always get the error:
Failed to start native messaging host.
However, if I launch the chrome.exe
via command prompt, everything works fine.
Things I tried with no success:
- The taskbar shortcut has no extra flags. The target field has the
following value:
"C:\Program Files(x86)\Google\Chrome\Application\chrome.exe"
- I tried with the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Chrome\NativeMessagingHosts\com.company.extension
- I tried with the registry under
HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.company.extension
- I tried with the registry entry under
HKEY_CURRENT_USER\Software\Google\Chrome\NativeMessagingHosts\com.company.extension
- Tried launching the
crome.exe
as administrator from the file explorer.
Update:
I added the flag --enable-logging --v=1
to the shortcut to enable logging and when I launch it I get the following output in the console:
[11036:4160:0302/113902.866:ERROR:native_process_launcher_win.cc(140)] COMSPEC is not set
[11036:11856:0302/113902.882:ERROR:native_process_launcher_win.cc(140)] COMSPEC is not set
Update
Upon investigating the chrome.exe
process via Process Monitor, I found that there is no COMSPEC
environment variable available to it when it is spawned via explorer
.
Is there anything else that I can try or something that I am missing here?