【发布时间】:2015-07-09 23:25:06
【问题描述】:
我有一个映射驱动器的 VBS 脚本。根据用户,映射通用文件夹(不需要凭据)或个人文件夹(需要用户名和密码)。我目前正在为此使用标准 WSH 输入,这显然不太安全,因为密码没有被屏蔽
我已经使用 ScriptPW.dll 研究过解决方案,但这不再是 Windows 的本机(我使用的是 Windows 7),并且在从 XP 复制并注册时不起作用。
我现在正在研究的一个解决方案是使用 HTA 来提示输入用户名/密码。我已经到了在需要时运行文件的地步,但我不确定如何(或者即使我可以)将输入值从表单返回到父脚本。
这可能吗?
注意 - 由于并非在所有情况下都需要该表格,因此我无法将整个脚本放在 HTA 中。
这就是我如何称呼 HTA -
Dim Shell
Set Shell = Wscript.CreateObject("Wscript.Shell")
Shell.Run("test.hta"), 1, True
Set Shell = Nothing
这是 HTA -
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Login Application</title>
<hta :application
applicationname="LoginBox"
border="dialog"
borderstyle="normal"
caption="My HTML Application"
contextmenu="no"
maximizebutton="no"
minimizebutton="yes"
navigable="no"
selection="no"
showintaskbar="yes"
singleinstance="yes"
sysmenu="yes"
version="1.0"
windowstate="normal" />
</head>
<body>
<form id="LoginForm">
Enter Username: <input type="textbox" id="UserName"/><br />
Enter Password: <input type="password" id="Password"/><br />
<input type="submit" value="Open my scans"/>
</form>
</body>
</html>
【问题讨论】:
-
不要将用户名和密码返回给调用者。在 HTA 中映射驱动器