VBscript - wscript.echo 在 Windows 7 中完美 - 在 Window 2012 中不起作用 [英] VBscript - wscript.echo perfect in Windows 7 - does not work in Window 2012
问题描述
我创建了以下 vbs 脚本来显示我的问题
I've created the following vbs script to show my problem
Wscript.echo "My very first script."
Dim price, vat, net
vat = 16.0
net = 100.0
price = net * (1.0 + vat/100.0)
WScript.Echo "Price: ", price, "US $ Tax: ", vat, "% ", price - net, " US $"
当我在我的笔记本电脑(Windows 7 Professional)上运行它时,一切都很美好它显示第一条回显消息 - 我点击确定然后它显示第二条回显消息 - 我再次点击确定,脚本结束
When I run this on my laptop (Windows 7 Professional) everything is beautiful It displays the first echo message - I click on OK It then displays the second echo message - again I get to click OK and the script ends
然后我将其上传到我们的服务器(Windows Server 2012 Standard)和
I then upload it to our server (Windows Server 2012 Standard) and
它显示第一个 Wscript.echo 大约 2 秒然后结束.如果我注释掉第一条消息,它会显示第二条消息 - 再次显示几秒钟然后结束.
It displays the first Wscript.echo for about 2 seconds then ends. If I comment out the first message it then displays the second message - again for a couple of seconds then ends.
任何人都可以对此有所了解吗?
Can anyone shed any light on this?
推荐答案
看起来像超时
//T:nn Time out in seconds:允许脚本运行的最长时间
//T:nn Time out in seconds: Maximum time a script is permitted to run
设置为低值.你可以通过执行
is set to a low value. You can check this assumption by executing
WScript.Echo WScript.Timeout
请参阅中的为脚本设置超时值"部分文档.
您可以通过命令行界面 (//T,//S) 更改(默认)超时:
You can change the (default) timeout via the command line interface (//T, //S):
cscript
Usage: CScript scriptname.extension [option...] [arguments...]
Options:
//B Batch mode: Suppresses script errors and prompts from displaying
//D Enable Active Debugging
//E:engine Use engine for executing script
//H:CScript Changes the default script host to CScript.exe
//H:WScript Changes the default script host to WScript.exe (default)
//I Interactive mode (default, opposite of //B)
//Job:xxxx Execute a WSF job
//Logo Display logo (default)
//Nologo Prevent logo display: No banner will be shown at execution time
//S Save current command line options for this user
//T:nn Time out in seconds: Maximum time a script is permitted to run
//X Execute script in debugger
//U Use Unicode for redirected I/O from the console
和/或 .vbs 文件的脚本"属性.
and/or the "Script" properties of the .vbs file.
但是,在进行实验之前,您应该与该服务器的管理员交谈.
Before experimenting, however, you should talk to the admin of that server.
(顺便说一句:无论您做什么,不要将您正确的 WScript.Echo 行更改为错误 就像 MsgBox("Price")
)
(BTW: Whatever you do, don't change your correct WScript.Echo lines to something wrong like MsgBox("Price")
)
这篇关于VBscript - wscript.echo 在 Windows 7 中完美 - 在 Window 2012 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!