2
I have a web application that requires the use of a Chrome command line option to run successfully. My users will be receiving emails with hyperlinks to invoke the web application in Chrome on their PCs. How can I invoke Chrome with a command line option when a hyperlink is clicked in an email? Obviously I will have to make Chrome the default browser on each user's PC but I do not know how to ensure that every invocation of Chrome includes that command line option.
Try
chrome "https://msn.com"
orSTART "" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "https://msn.com"
as a starting point. Replace msn.com with the URL of your choice though. You won't need to set Chrome as the default web browser if you use it's full explicit path and then pass it the URL you need it to open by the way. – Pimp Juice IT – 2017-08-11T20:33:00.613So you are suggesting that the href I use in my anchor tag when I send the email would look like your example? – jlavallet – 2017-08-11T20:35:58.413
I know how to invoke Chrome from the command line (including my command line option which happens to be
--explicitly-allowed-ports=8734
) but I do not believe I can embed all that you just suggested in the HREF of my anchor tag. – jlavallet – 2017-08-11T20:38:46.023Is the Hyperlink dynamic or static? I mean if it is always a static link that points to a URL (that never changes) - send them a pre-made shortcut or .lnk file. And the shortcut target could be something like
"%PROGRAMFILES(x86)%\Google\Chrome\Application\chrome.exe" --explicitly-allowed-ports=8734 https://myapp.domain.com
. I'm not sure if you can attach a .lnk file (your mail server may quarantine them) but you definitely can copy and paste .lnk files between computers. If it is a constantly changing URL... I guess you can keep making new .lnk file and share the new one? – Darius – 2017-08-11T20:49:40.480Good call on using the environment variable so
– Pimp Juice IT – 2017-08-11T23:27:30.997file:///%PROGRAMFILES(x86)%\Google\Chrome\Application\chrome.exe
but I'm not sure about passing the arguments and URL to the site but have a look at https://stackoverflow.com/questions/2140585/pass-arguments-when-using-the-file-protocol as it may or may not be possible. There may be a workaround but I'm not 100% certain but maybe this will give others ideas to help give you a great answer that will suffice.Another idea would be to have a batch script on all the machines in a standard folder or a UNC file share where it can be read and executed by the users that click on the link and the batch file would have the
START "" "%PROGRAMFILES(x86)%\Google\Chrome\Application\chrome.exe" --explicitly-allowed-ports=8734 https://myapp.domain.com
logic in it just as I (and Darius) mentioned above, and the hyperlink could point to the batch so once clicked it executes the batch with the logic needed to tell Windows and Chrome to do its thingfile:///\\server\share\folder\batchfile.cmd
– Pimp Juice IT – 2017-08-11T23:33:29.583If you use the UNC share and path for the batch script, you'd only need to maintain the one batch script, you could make changes to it in one place if changes are needed with the URL, parameters, etc. and the URL HREF link you send never changes and all users would have read-only and execute access to the batch script so they would not be able to modify it themselves. Maybe a simple solution for you but otherwise you could have the batch script on all local machines in the same one folder on all e.g.
C:\Scripts
but you'd need to update on for a simple changes with that method. Quick ideas. – Pimp Juice IT – 2017-08-11T23:36:56.020