标题: [问题求助] 求解释一段生成压缩包的VBS代码 [打印本页]
作者: 喃喃努努 时间: 2012-7-4 08:25 标题: 求解释一段生成压缩包的VBS代码
有一段代码看不懂,求大神解释,好像是生成压缩包的脚本,但是具体的就不知道怎么运行的,求详解。- Dim cmdd
- Dim da,ti, yy,dd,mm,hh
-
- da=FormatDateTime(Date,2)
- 'MsgBox da
- ti=FormatDateTime(Time,4)
- 'MsgBox ti
-
- if instr( da,"-") > 0 then
- mm=split(da,"-")(1)
- dd=split(da,"-")(2)
- yy=split(da,"-")(0)
- else
- mm=split(da,"/")(0)
- dd=split(da,"/")(1)
- yy=split(da,"/")(2)
- end if
-
- hh=split(ti,":")(0)
-
- If(mm<10)Then
- cmdd=yy&"0"&mm
- Else cmdd=yy&mm
- End If
- If(dd<10)Then
- cmdd=cmdd&"0"&dd
- Else cmdd=cmdd&dd
- End If
- cmdd=cmdd&hh&minuteM&"-F.tar"
-
-
-
- 'MsgBox cmdd
- 'MsgBox FormatDateTime(Date,4)
- If(1) Then
- set sh=WScript.CreateObject("WScript.Shell")
- sh.run "C:\WINDOWS\system32\cmd.exe"
- WScript.Sleep 1000
- sh.SendKeys "telnet xx.xx.xx.xx"
- sh.SendKeys "{ENTER}"
- WScript.Sleep 1000
- sh.SendKeys "prod{ENTER}"
- WScript.Sleep 1000
- sh.SendKeys "prod{ENTER}"
- WScript.Sleep 1000
- sh.SendKeys "pwd {ENTER}"
- WScript.Sleep 500
- sh.SendKeys "cd /xx/xxxx/xxxxx/xxxxxx {ENTER}"
- WScript.Sleep 500
- sh.SendKeys "ls {ENTER}"
- WScript.Sleep 500
- sh.SendKeys "rm -r MACTMP.exe {ENTER}"
- WScript.Sleep 500
- sh.SendKeys "tar -cvf "&cmdd&" *{ENTER}"
- WScript.Sleep 500
- sh.SendKeys "gzip "&cmdd&"{ENTER}"
- WScript.Sleep 500
- sh.SendKeys "pwd {ENTER}"
- WScript.Sleep 500
- sh.SendKeys "exit {ENTER}"
- WScript.Sleep 500
- sh.SendKeys "{ENTER}"
- WScript.Sleep 500
- sh.SendKeys "exit {ENTER}"
- WScript.Sleep 500
- WScript.Quit
- End If
复制代码
作者: CrLf 时间: 2012-7-4 13:23
发送按键、发送按键 and 发送按键...
作者: forfiles 时间: 2012-7-4 15:18
用VBS发送按键模拟你自己手工点鼠标的操作
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |