回复 20# zhanglei1371
可以这样玩下:- var cmd = new Command()
-
- var str = cmd.set.p('请输入任意算式,回车确定\n')
- try{
- cmd.set.a('Num='+str)
- cmd.echo('结果是:'+Num)
- }
- catch(e){
- cmd.echo(Num)
- cmd.exit(1)
- }
- cmd.set.p('任意键退出')
-
- function Command(){
- this.echo = function (str){WScript.Echo(str)}
- this.exit = function (num){WScript.Quit(num)}
- this.set = {
- a:function (str){eval(str)},
- p:function (str){
- WScript.StdOut.Write(str)
- return WScript.StdIn.ReadLine()
- }
- }
- }
复制代码
|