rem =telnet=
@del %TFILE%
@echo on error resume next >>%TFILE%
@echo dim WshShell>>%TFILE%
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>%TFILE%
@echo WshShell.run"cmd">>%TFILE%
@echo WshShell.AppActivate"c:\windows\system32\cmd.exe">>%TFILE%
@echo WScript.Sleep 200>>%TFILE%
@echo WshShell.SendKeys"telnet %IP%">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 100>>%TFILE%
@echo WshShell.AppActivate"telnet.exe ">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"%UName%">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"%UPaswd%">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"rm -rf Carrier* ">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"exit">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@call %TFILE%
rem =ftp=
echo open %BMP_IP% >%TF_FILE%
echo user %UName% %UPaswd% >>%TF_FILE%
echo prompt off >>%TF_FILE%
echo bin >>%TF_FILE%
echo put Carrier* >>%TF_FILE%
echo put upgradePackage.sh >>%TF_FILE%
echo bye >>%TF_FILE%
ftp -n -s:%TF_FILE%
del %TF_FILE%
@del %TFILE%
@echo on error resume next >>%TFILE%
@echo dim WshShell>>%TFILE%
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>%TFILE%
@echo WshShell.run"cmd">>%TFILE%
@echo WshShell.AppActivate"c:\windows\system32\cmd.exe">>%TFILE%
@echo WScript.Sleep 200>>%TFILE%
@echo WshShell.SendKeys"telnet %IP%">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 100>>%TFILE%
@echo WshShell.AppActivate"telnet.exe ">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"%UName%">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"%UPaswd%">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"rm -rf Carrier* ">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@echo WScript.Sleep 1000>>%TFILE%
@echo WshShell.SendKeys"exit">>%TFILE%
@echo WshShell.SendKeys"{ENTER}">>%TFILE%
@call %TFILE%
rem =ftp=
echo open %BMP_IP% >%TF_FILE%
echo user %UName% %UPaswd% >>%TF_FILE%
echo prompt off >>%TF_FILE%
echo bin >>%TF_FILE%
echo put Carrier* >>%TF_FILE%
echo put upgradePackage.sh >>%TF_FILE%
echo bye >>%TF_FILE%
ftp -n -s:%TF_FILE%
del %TF_FILE%

本文介绍了一种通过Telnet连接远程服务器并执行文件删除操作的方法,并进一步利用FTP协议实现文件上传过程。整个流程涉及使用批处理脚本、VBS脚本及Windows Shell对象来自动化这些任务。
820

被折叠的 条评论
为什么被折叠?



