我正在尝试创建一个按钮,以便更容易地让每个人访问并执行批处理文件。
<input type="button" value="Test" onclick="window.open('bat:///\\123.hello.net\FileShares\ Logon\SAPfileConfig.bat')" />
每当我在IE上执行时,它都会显示找不到文件的错误。
我可能做错了什么?
我正在尝试创建一个按钮,以便更容易地让每个人访问并执行批处理文件。
<input type="button" value="Test" onclick="window.open('bat:///\\123.hello.net\FileShares\ Logon\SAPfileConfig.bat')" />
<html>
<head>
<title>Run Exe or Batch files with Javascript and HTA</title>
<HTA:APPLICATION
APPLICATIONNAME="Run Exe or Batch files with Javascript and HTA"
ID="MyHTMLapplication"
VERSION="1.0"/>
</head>
<script language="Javascript">
function RunMe(){
var shell = new ActiveXObject("WScript.Shell");
var path = '"file:\\\\123.hello.net\\FileShares\\Logon\\SAPfileConfig.bat"';
shell.run(path,1,false);
}
</script>
<input style="width: 170px; height:23px; color: white; background-color: #203040;
font-family:Book Antiqua;" type="button" Value="Execute Batch File" onClick="RunMe();"
</html>
您可以使用Vbscript和HTA运行Exe或批处理文件:
Vbscript_Execute.hta
<html>
<head>
<title>Run Exe or Batch files with Vbscript and HTA</title>
<HTA:APPLICATION
APPLICATIONNAME="Run Exe or Batch files with Vbscript and HTA"
ID="MyHTMLapplication"
VERSION="1.0"/>
</head>
<script language="Vbscript">
Function RunMe()
Dim Shell,path
Set shell = CreateObject("WScript.Shell")
path = "file:\\123.hello.net\FileShares\Logon\SAPfileConfig.bat"
shell.run path,1,false
End Function
</script>
<input style="width: 170px; height:23px; color: white; background-color: #203040;
font-family:Book Antiqua;" type="button" Value="Execute Batch File" onClick="RunMe()"
</html>
bat:///
? - Hackoo