protocolscommand-line-argumentsfile-uri

Pass arguments when using the File protocol


I found this question being asked on several places on the internet (including the file: protocol MSDN page) but no clear answer.

If I am calling my application like:

file://c:\myapp.exe

...is there any way to pass it some command line arguments? As an example:

/nospashscreen=true

I've tried:

file://c:\myapp.exe?/nospashscreen=true

...which launches the app, but with no command line arguments. :(

Thanks in advance.


Solution

  • I am assuming you are using Windows? If so, there is no way to pass a parameter using the "file://" syntax, as it is an Asynchronous Pluggable Protocol that does not accept parameters.

    However, if you really need it, you can craft your own pluggable protocol that accepts parameters.

    Here's an example:

    An Asynchronous Pluggable Protocol Handler for data: URLs