0

I have an HMTL file that I would like to be opened with the user's default browser, followed by a parameter. For example, if your default browser was Google Chrome, it would open as:

C:/Users/[User]/AppData/Local/Google/Chrome/Applications/chrome.exe -[parameter]

This probably isn't how this should be handled, and I know this isn't secure or ideal. But I would like to know how (if you even can at all) you could make this happen.

Thanks.

3
  • 2
    What would this parameter be for? The web page, or the browser? Jul 25, 2014 at 20:46
  • yeah that is how it works normally!! chrome %1 where %1 is the parameter which is the html file
    – barlop
    Jul 25, 2014 at 23:33
  • @Ƭᴇcʜιᴇ007 the parameter would be for the browser. The exact parameter I need is --allow-file-access-from-files.
    – Mike
    Jul 28, 2014 at 13:03

1 Answer 1

1

On a Windows System use:

cmd /c start http://superuser.com


What this command does is:

cmd Opens the command line window.
/c is a parameter for the command line window. It tells the command line window to close itself after finishing.

This command line window shall run the command start.

start opens a new command prompt, to run a command.
The command that start shall run is in this case: http://superuser.com

start http://superuser.com means, open the http://superuser.com with the default program assigned to it.


Which program is assigned can be looked up in the command line window with: ftype, and assoc In case of the http protocoll you can use ftype and search for the entry starting with http= to see which program is assigned to it.
If nothing is assigned in ftype or assoc, then explorer.exe is called with the parameter of start.

2
  • I know this is dumb, but some people might not understand what this does. Can you explain it, even just a little?
    – Jon
    Jul 31, 2014 at 1:17
  • This is almost exactly what I need, but when I open the file (run the shortcut) it doesn't seem that the parameters are applied. Is there another way to apply the parameter to the end of this other than: cmd /c start http://superuser.com -[param] ?
    – Mike
    Jul 31, 2014 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .