通过html链接将参数传递给程序 [英] pass parameter to a program through html link
问题描述
当我使用这个
$ b时,我们需要从本地用户的文件系统运行一个程序。 $ b
< a href =C:\Windows\System32\NETSTAT.EXE>点击< / a>
工作正常。但是,当我尝试传递参数到exe文件时,它失败了。
< a href =C:\Windows \System32\NETSTAT.EXE -a>点击< / a>
任何人都知道如何传递参数?
感谢
更新
如下:如果系统中有新的记录可用,在线系统会向用户发送电子邮件。因此,用户将点击他们的电子邮件客户端中的链接,该链接将用所需的参数打开他们的本地exe程序,以显示新记录。
我不想用bat文件发送电子邮件,因为我的网络管理员不允许这样做。
我只看到一个解决方案,使用.BAT文件,其中将是netstat.exe -a,例如netstat-a.bat。
< a href =C:\Windows\System32\NETSTAT-A.BAT> CLICK< / a>
这是一个非常不太好的解决方案,但可以工作:)
您也可以尝试此代码,但它取决于浏览器和用户权限:
< html>
< head>
< script language =JavaScripttype =text / javascript>
MyObject = new ActiveXObject(WScript.Shell)
函数RunNotePad()
{
MyObject.Run(netstat.exe -a);
}
< / script>
< / head>
< body>
< h1>执行程式< / h1>
此脚本启动文件>> C:\windows\\\
otepad.exe< p为H.
< button onclick =RunNotePad()>运行Windows NotePad< / button>
< / body>
< / html>
I need to run a program from the local user's file system by clicking an html link.
When i use this
<a href="C:\Windows\System32\NETSTAT.EXE">CLICK</a>
It works fine. But When i try to pass a parameter to the exe file it fails.
<a href="C:\Windows\System32\NETSTAT.EXE -a">CLICK</a>
Anyone has an idea how is it possible to pass the parameter?
Thanks
UPDATE
The use of this is the following: An online system sends emails to users if a new record is available in the system. Therefore the users will click a link from their email client that will open their local exe program with the desired parameter, to show the new record.
I don't want to send emails with bat files since it is not allowed by my network admin.
I see only one solution, use .BAT file, where will be "netstat.exe -a", named for example netstat-a.bat.
<a href="C:\Windows\System32\NETSTAT-A.BAT">CLICK</a>
It's quite impertect solution, but can works :)
You can also try this code, but it depend of browser and user rights:
<html>
<head>
<script language="JavaScript" type="text/javascript">
MyObject = new ActiveXObject( "WScript.Shell" )
function RunNotePad()
{
MyObject.Run("netstat.exe -a") ;
}
</script>
</head>
<body>
<h1>Run a Program</h1>
This script launch the file >> c:\windows\notepad.exe<p>
<button onclick="RunNotePad()">Run Windows NotePad</button>
</body>
</html>
这篇关于通过html链接将参数传递给程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!