我有一个 HTA 文件,它打开一个文本框,允许用户输入文件夹的路径,然后将其保存到文本文件中。
但是当我尝试使用第二个按钮运行批处理时,它给了我一个错误代码
<html>
<head>
<title>Files Sync </title>
<HTA:APPLICATION
APPLICATIONNAME="Files Sync"
ID="RY"
VERSION="1.0"/>
</head>
<script language="vbscript">
Sub WriteTxt_OnClick()
Dim fso, txt
Set fso = CreateObject("Scripting.FileSystemObject")
Set txt = fso.CreateTextFile("\\fs-02\C$\ntfs3\scripts\MexSync\000.txt")
txt.WriteLine document.Submitted_Link_To_Mex.body.value
MsgBox "File Submitted",64,"Selection"
End Sub
Sub SYNC_onClick()
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd.exe /c C:\work\RLTP_SYNC_MEX\RunChangePS1.bat", 0
' 0 => hide
MsgBox("Success")
End Sub
</script>
<H2>Copy And Paste The Folder Path To Here </H2>
<body>
<form name="Submitted_Link_To_Mex">
<textarea name="body" cols="150" rows="20">
</textarea>
</form>
<br>
<input type="button" value="1. SUBMIT" name="WriteTxt">
<input type="Button" value="2. SYNC" name="SYNC">
<input type="Button" value="3. CLOSE" name="button2" onClick="close" class="button">
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我不明白为什么......做了一些研究但一点运气都没有 有什么建议吗?
您的行的 WScript 对象
Set WshShell = WScript.CreateObject("WScript.Shell")
Run Code Online (Sandbox Code Playgroud)
尝试使用 HTA 中不存在的内容(它由 w|cscript.exe 主机提供)。由于VBScript(语言本身)提供了自己的CreateObject函数,只需使用
Set WshShell = CreateObject("WScript.Shell")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24035 次 |
| 最近记录: |