ottawamona Posted December 3, 2015 Posted December 3, 2015 (edited) Hi AllI'm not sure what I'm doing wrong here. I am trying to pass a URL to chrome and launch it with a command line switch using ShellExecute. I've also tried Run but neither of them seem to work as soon as I introduce the switches I need to use: --no-first-run --no-default-browser-checkI've been trying to get just --no-first-run to work before adding the other one but I can't and I don't know what I'm doing wrong.If I run this from Windows Run, it works: C:\Program Files (x86)\google\chrome\application\chrome.exe --no-first-run google.comHere is the code I'm trying to use:If $CmdLine[0] = 2 then $arg = $CmdLine[1] $link = $CmdLine[2] Else Exit(0) EndIf ShellExecute("chrome.exe", $arg & " " & $link, '"C:\Program Files (x86)\Google\Chrome\Application\"' ) ;Run ('"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"' & " " & '"--no-first-run"' & " " & $link)I am calling it like this: runchrome.exe --no-first-run google.comIf I don't try to use $arg and just use $link for ShellExecute, chrome launches to the URL, no problem. The commented out Run also doesn't work but will if I don't try to use the switch. Any help would be appreciated.*Edit: What I mean by "doesn't work" is that chrome doesn't seem to launch at all. Edited December 3, 2015 by ottawamona
ottawamona Posted December 3, 2015 Author Posted December 3, 2015 I think it had to do with the way I was building the string. I cleaned it up and it looks like this now $linktorun = '"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --no-first-run --no-default-browser-check ' & $link Run ($linktorun) Run ($linktorun)For some strange reason, Chrome wants to shut down on the first launch so I'm launching it twice. That may have to do with the switches I'm using but at least it's launching now.
Radiance Posted December 3, 2015 Posted December 3, 2015 Hi & welcome to the forum!I have no idea what --no-first-run does so I tried it here with --incognito, seems to work.My guess would be that the command line parameters to your script don't get passed properly.Put this at the beginning at your script and post the output:Global $FullCmdLine If $CmdLine[0] > 0 Then For $i = 1 To $CmdLine[0] $FullCmdLine &= "(" & $i & ")" & $CmdLine[$i] Next EndIf MsgBox(0, "", $FullCmdLine)
ottawamona Posted December 3, 2015 Author Posted December 3, 2015 Thanks for the reply and the help! I was not forming the string properly. This worked in the end$linktorun = '"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --no-first-run --no-default-browser-check ' & $link Run ($linktorun):
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now