![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-05 00:07 |
共 48,038 主题排行 / 350,123 发帖 / 今日 0 篇 / 48,251 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 求cscript的shell代码改进 |
| 可打印版本 1,159 / 9 |
| 第1楼 wert123 | 发表于 2007-06-07 21:57 |
| 中级用户 发帖 135 积分 301 | |
|
求cscript的shell代码改进 关于下面的脚本,大家给点建议吧,怎么改进才好
比如说,好象不能cls啊,有谁能帮我加个类似lcls清屏的功能好吗 [ Last edited by wert123 on 2007-6-16 at 03:00 PM ] |
|
| 第2楼 wert123 | 发表于 2007-06-10 11:26 |
| 中级用户 发帖 135 积分 301 | |
|
有谁帮我改改啊
|
|
| 第3楼 slore | 发表于 2007-06-10 12:21 |
| 铂金会员 发帖 2,478 积分 5,212 | |
|
这个脚本写的不错嘛。。。
那cls的时候可以输出N个空行,把显示的推上去=。= 不然重运行下脚本…… 我不知道有类似cls的用法。。。。 |
|
| 第4楼 wert123 | 发表于 2007-06-11 11:20 |
| 中级用户 发帖 135 积分 301 | |
Originally posted by slore at 2007-6-10 12:21 PM: 我不知道谁写的,这本书的作者我忘了啊 就是象cmd下的cls一样的效果啊,vbs是没有,只要效果一样 clx,cl123,clslore都可以的,说明白点,就是用一个操作产生一种清屏效果的方法. |
|
| 第5楼 slore | 发表于 2007-06-11 13:45 |
| 铂金会员 发帖 2,478 积分 5,212 | |
|
host = WScript.FullName
hostexe = LCase(Mid(host, InstrRev(host, "\") + 1)) Set wshshell = CreateObject("WScript.Shell") If Not hostexe = "cscript.exe" Then wshshell.run "CSCRIPT.EXE """ & WScript.ScriptFullName & """" WScript.Quit End If Set input = WScript.StdIn Set output = WScript.StdOut output.Write "> " Do Until input.atEndOfStream line = input.ReadLine If LCase(line) = "exit" Then Exit Do ElseIf LCase(line) = "cls" Then '这个是重载的……不过效果像,但是 '不像CMD下可以支持之前输入的东西 wshshell.run "CSCRIPT.EXE """ & WScript.ScriptFullName & """" WScript.Quit Else line = Replace(line, "?", "output.WriteLine") ExecuteIt line output.Write "> " End If Loop Sub ExecuteIt(command) on Error Resume Next ExecuteGlobal command If Not Err.Number = 0 Then output.WriteLine "Error: " & Err.description Err.clear End If End Sub |
|
| 第6楼 wert123 | 发表于 2007-06-14 20:06 |
| 中级用户 发帖 135 积分 301 | |
|
非常感谢啊,不过再次运行后窗口出现在不同位置,视觉上好像感觉不够好
在该窗口中按cls后往上推30行,能帮我这样写个吗? |
|
| 第7楼 slore | 发表于 2007-06-14 20:11 |
| 铂金会员 发帖 2,478 积分 5,212 | |
|
有个什么blankline好象……
|
|
| 第8楼 wert123 | 发表于 2007-06-14 20:39 |
| 中级用户 发帖 135 积分 301 | |
Originally posted by slore at 2007-6-14 08:11 PM: 好象什么啊,关键时候怎么掉链子呢 |
|
| 第9楼 slore | 发表于 2007-06-14 21:39 |
| 铂金会员 发帖 2,478 积分 5,212 | |
|
你怎么为什么不用google把链子连起来?
host = WScript.FullName hostexe = LCase(Mid(host, InstrRev(host, "\") + 1)) Set wshshell = CreateObject("WScript.Shell") If Not hostexe = "cscript.exe" Then wshshell.run "CSCRIPT.EXE """ & WScript.ScriptFullName & """" WScript.Quit End If Set input = WScript.StdIn Set output = WScript.StdOut output.Write "> " Do Until input.atEndOfStream line = input.ReadLine If LCase(line) = "exit" Then Exit Do ElseIf LCase(line) = "cls" Then output.WriteBlankLines 30 output.Write "> " Else line = Replace(line, "?", "output.WriteLine") ExecuteIt line output.Write "> " End If Loop Sub ExecuteIt(command) on Error Resume Next ExecuteGlobal command If Not Err.Number = 0 Then output.WriteLine "Error: " & Err.description Err.clear End If End Sub |
|
| 第10楼 wert123 | 发表于 2007-06-16 14:58 |
| 中级用户 发帖 135 积分 301 | |
|
谢谢你啊,slore大师技术好,又热心,辛苦了啊!
也许要写个.dll或者.ocx文件吧, 我不会再问像这样的问题了:store你帮我写个vbs把局域网的电停了 [ Last edited by wert123 on 2007-6-16 at 03:44 PM ] |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |