GUI前端用于.BAT文件和传递变量 [英] GUI front end for .BAT file and passing variables
问题描述
您好,
我希望制作一个.HTA前端,将用户输入加载为变量并将其传递给Windows批处理文件以运行:
I am looking to make an .HTA fronto end to load user input as variables and pass these out to a Windows batch file to run:
例如变量=西,东,南,北(在.hta文件中)
eg variables = west, east, south, north (in the .hta file)
调用test.bat并运行
call test.bat and run
返回.hta菜单和/或关闭
Return to menu of .hta and/or close
批处理文件包含以下条目:set region =" -R%west%/%east%/%south%/ %北方%QUOT;这些是我想从hTA传递的变量。我没有设法获取要传递的变量,但可以让批处理文件运行。
The batch file contains the entry : set region="-R%west%/%east%/%south%/%north%" where these are the variables I want to pass from the hTA.I have not managed to get the variables to be passed but can get the batch file to run.
任何帮助都会很棒。
Lester
推荐答案
你可以在你的hta中嵌入一些VBScript代码,然后使用Run调用批处理文件的方法。更好的解决方案是完全删除批处理文件并将整个逻辑放入VBScript中。
You could embed some VBScript code in your hta, then use the Run method to invoke the batch file. A better solution would be to drop the batch file altogether and put the whole logic into the VBScript.
< SCRIPT Language =" VBScript">
设置oWshShell = CreateObject(" WScript.Shell")
oWshShell.Run" c:\Scripts\MyBatch .bat" &安培; sParm1& " " &安培; sParm2,1,True
< / SCRIPT>
这篇关于GUI前端用于.BAT文件和传递变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!