2008年10月2日 星期四

Auto Telnet by WScript

'Get Parameter List
set arg=WScript.Arguments

' Create Script Shell
set sh=WScript.CreateObject("WScript.Shell")

'Run Telnet Command
sh.Run "cmd.exe /c start /realtime telnet xxx.xxx.xxx.xxx "

'Wait Command Running and Response
WScript.Sleep 300
'Input User Name and Password
sh.SendKeys "User Name {ENTER}"
WScript.Sleep 300
sh.SendKeys "Password {ENTER}"
WScript.Sleep 300

'Run your Command
sh.SendKeys "ls -al "+arg.item(0)+" "+arg.item(1)+"{ENTER}"
'Set Sleep time by your Command Running Time
WScript.Sleep 500

'Exit Telnet
sh.SendKeys "exit{ENTER} "
WScript.Sleep 300

'Exit cmd windows
sh.SendKeys "^C"
WScript.Sleep 300

沒有留言:

[Excel]如何創建自定義函數

在 Excel 內建函式中找不到自已想要的函式怎麼辦?事實上我們可以自已建一個,以下是一個簡單的Excel自定義函數示例,用於將民國年轉為西元: Function 民國轉西元(x As Double) As Double     民國轉西元 = x + 1911 End Func...