file:// command-line arguments

0

Is it possible to pass command-line arguments to a program that is invoked via a file:// url?

I'm trying to include Remote Desktop links in a wiki page that lists some servers:

<a href="file:///c|/windows/system32/mstsc.exe /v:serverName">serverName</a>

When I omit the argument the link works fine, but when I include it the link doesn't work. I Googled around a bit and couldn't find any references to this. I suspect that the answer is that file:// urls simple don't accept arguments (I can think of all kinds of ways to abuse them if they do), but I thought I'd throw it out there in case I've simply got the syntax wrong.

Thanks.

Cory Grimster

Posted 2011-02-28T21:30:28.690

Reputation: 101

Answers

1

What I've seen other tools do is provide a *.rdp file you download and invoke. If you can attach these files to your wiki page, it's a pretty simple format. Here's a sample:

screen mode id:i:2
use multimon:i:0
desktopwidth:i:1366
desktopheight:i:768
session bpp:i:32
winposstr:s:0,1,0,0,1366,728
compression:i:1
keyboardhook:i:2
audiocapturemode:i:0
videoplaybackmode:i:1
connection type:i:2
displayconnectionbar:i:1
disable wallpaper:i:1
allow font smoothing:i:0
allow desktop composition:i:0
disable full window drag:i:1
disable menu anims:i:1
disable themes:i:0
disable cursor setting:i:0
bitmapcachepersistenable:i:1
full address:s:**SERVERNAMEHERE**
audiomode:i:0
redirectprinters:i:0
redirectcomports:i:0
redirectsmartcards:i:1
redirectclipboard:i:1
redirectposdevices:i:0
redirectdirectx:i:1
autoreconnection enabled:i:1
authentication level:i:2
prompt for credentials:i:0
negotiate security layer:i:1
remoteapplicationmode:i:0
alternate shell:s:
shell working directory:s:
gatewayhostname:s:
gatewayusagemethod:i:4
gatewaycredentialssource:i:4
gatewayprofileusagemethod:i:0
promptcredentialonce:i:1
use redirection server name:i:0
drivestoredirect:s:

Joel Coehoorn

Posted 2011-02-28T21:30:28.690

Reputation: 26 787

Interesting...I'm not sure if I'll use that in this particular situation, but it does give me some ideas. I hadn't realized that rdp files were just text. Thanks :) – Cory Grimster – 2011-03-01T15:37:19.577

0

Unfortunately that's not the way the common gateway interface (CGI) works.

There are 3 methods of passing parameters to a script - GET (filename.ext?param1=foo&param2=bar), POST (data is read by the standard input of the script) and PATHINFO (filename.exe/val1/val2/val3)

None of these are even remotely like command line arguements.

Your best bet would probably to be to set up short cuts to the commands you want to run including their command line parameters and linking to those shortcuts.

Majenko

Posted 2011-02-28T21:30:28.690

Reputation: 29 007

CGI only applies to requests made with the HTTP protocol, and file:// URIs access the filesystem directly. – user1686 – 2011-03-01T13:30:38.457

It's still subject to how the browser passes parameters - which is down to the CGI protocol. – Majenko – 2011-03-01T15:55:43.570