作者KCda260 (KCda260)
看板EZsoft
標題Getting User Input
時間Fri Dec 14 03:07:23 2007
很有趣的方法
給喜歡玩Windows Scripting & batch user
Windows Scripting If you have Win98, NTSP4, or something newer, you should
have Windows Scripting. If you don't have it, download it. Here I show a
batch file that runs a pre-built visual basic script "userin.vbs". That
script, when run, will create a simple one-line batch file "~userin.bat"
which puts the user input into the environment. Because this is a batch web
page and not a scripting web page, all you'll get is the sample script with
no explanation...
Here is the batch file:
start /w wscript.exe userin.vbs
call ~userin.bat
del ~userin.bat
echo You entered %USERIN%
Now the script file I call "userin.vbs"
strUserIn = InputBox("Enter Data")
Set fs = CreateObject("Scripting.FileSystemObject")
strFileName = fs.BuildPath(Wscript.ScriptFullName & "\..", "~userin.bat")
strFileName = fs.GetAbsolutePathName(strFileName)
Set ts = fs.OpenTextFile(strFileName, 2, True)
ts.WriteLine "set userin=" & strUserIn
ts.Close
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.121.65.240
※ KCda260:轉錄至看板 Programming 12/14 03:08
1F:推 dingyuchi:這可以用在哪阿?? 12/14 15:51