如果我们的本地的服务太多,每次都需要找到对应的位置才能启动服务。因此我们想通过网页一次录入地址,打开连接的方式启动服务。
localservice.html
<html>
<body>
<a href="sims://D:\Program Files (x86)\Tencent\QQ\Bin\QQScLauncher.exe">打开QQ</a><hr/>
<a href="sims://C:\Users\Administrator\Desktop\jmeter.bat">启动jmeter</a><hr/>
<body>
</html>
页面
sims地址使用的前提,本地要先注册sims协议
sims.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SIMS]
@="SIMS Protocol"
"URL Protocol"="C:\\PROGRA~1\\sims\\sims.bat %1"
[HKEY_CLASSES_ROOT\SIMS\shell\open\command]
@="C:\\PROGRA~1\\sims\\sims.bat %1"
sims.bat
@echo off
cd /d %~dp0
set ifo=%1
set pragram=%ifo:~7,-1%
start ./sims.vbs %pragram%
sims.vbs
REM zhushi
args1=WScript.Arguments.Item(0)
args1=Replace(args1,"%5C","\")
args1=Replace(args1,"%20"," ")
args2=Right(args1,3)
If StrComp(args2,"exe")=0 Then
createobject("wscript.shell").run """" & CStr(args1) & """",0
ElseIf StrComp(args2,"bat")=0 Then
createobject("wscript.shell").run CStr(args1),0
Else
End If