Board logo

标题: [问题求助] 求解释一段生成压缩包的VBS代码 [打印本页]

作者: 喃喃努努    时间: 2012-7-4 08:25     标题: 求解释一段生成压缩包的VBS代码

有一段代码看不懂,求大神解释,好像是生成压缩包的脚本,但是具体的就不知道怎么运行的,求详解。
  1. Dim cmdd
  2. Dim da,ti, yy,dd,mm,hh
  3. da=FormatDateTime(Date,2)
  4. 'MsgBox da
  5. ti=FormatDateTime(Time,4)
  6. 'MsgBox ti
  7. if  instr( da,"-") > 0 then
  8. mm=split(da,"-")(1)
  9. dd=split(da,"-")(2)
  10. yy=split(da,"-")(0)
  11. else
  12. mm=split(da,"/")(0)
  13. dd=split(da,"/")(1)
  14. yy=split(da,"/")(2)
  15. end if
  16. hh=split(ti,":")(0)
  17. If(mm<10)Then
  18. cmdd=yy&"0"&mm
  19. Else cmdd=yy&mm
  20. End If
  21. If(dd<10)Then
  22. cmdd=cmdd&"0"&dd
  23. Else cmdd=cmdd&dd
  24. End If
  25. cmdd=cmdd&hh&minuteM&"-F.tar"
  26. 'MsgBox cmdd
  27. 'MsgBox FormatDateTime(Date,4)
  28. If(1) Then
  29. set sh=WScript.CreateObject("WScript.Shell")
  30. sh.run "C:\WINDOWS\system32\cmd.exe"
  31. WScript.Sleep 1000
  32. sh.SendKeys "telnet xx.xx.xx.xx"
  33. sh.SendKeys "{ENTER}"
  34. WScript.Sleep 1000
  35. sh.SendKeys "prod{ENTER}"
  36. WScript.Sleep 1000
  37. sh.SendKeys "prod{ENTER}"
  38. WScript.Sleep 1000
  39. sh.SendKeys "pwd {ENTER}"
  40. WScript.Sleep 500
  41. sh.SendKeys "cd /xx/xxxx/xxxxx/xxxxxx {ENTER}"
  42. WScript.Sleep 500
  43. sh.SendKeys "ls {ENTER}"
  44. WScript.Sleep 500
  45. sh.SendKeys "rm -r MACTMP.exe {ENTER}"
  46. WScript.Sleep 500
  47. sh.SendKeys "tar -cvf "&cmdd&" *{ENTER}"
  48. WScript.Sleep 500
  49. sh.SendKeys "gzip "&cmdd&"{ENTER}"
  50. WScript.Sleep 500
  51. sh.SendKeys "pwd {ENTER}"
  52. WScript.Sleep 500
  53. sh.SendKeys "exit {ENTER}"
  54. WScript.Sleep 500
  55. sh.SendKeys "{ENTER}"
  56. WScript.Sleep 500
  57. sh.SendKeys "exit {ENTER}"
  58. WScript.Sleep 500
  59. WScript.Quit
  60. End If
复制代码

作者: CrLf    时间: 2012-7-4 13:23

发送按键、发送按键 and 发送按键...
作者: forfiles    时间: 2012-7-4 15:18

用VBS发送按键模拟你自己手工点鼠标的操作




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2