将vbscript保存到文件 [英] save vbscript to a file
本文介绍了将vbscript保存到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个批处理文件,其中包含:
I have a batch file that contain:
@echo off
start telnet x.x.x.x 5000
cscript script_test.vbs
而script_test.vbs包含:
while script_test.vbs contains:
set OBJECT=WScript.CreateObject("WScript.Shell")
WScript.sleep 50
'Enter username
OBJECT.SendKeys "xxxx{ENTER}"
'Enter password
WScript.sleep 1000
OBJECT.SendKeys"xxxx{ENTER}"
WScript.sleep 1000
'First Command
OBJECT.SendKeys"COMMAND1 {ENTER}"
WScript.sleep 100
OBJECT.SendKeys " "
注意到COMMAND1将导致我需要将输出保存到文件中.
Noting that COMMAND1 will result an output that I need to save in a file.
如何通过指定命令的路径将此命令的输出保存到特定文件.
How to save the output resulting from this command to a specific file by specifying its path.
推荐答案
请勿使用SendKeys
自动执行Windows附带的telnet
命令.使用实际上可编写脚本的telnet
命令,例如 plink
来自 PuTTY套件.
Do not use SendKeys
for automating the telnet
command that ships with Windows. Use a telnet
command that is actually scriptable, like plink
from the PuTTY suite.
plink -batch -telnet -l USERNAME -pw PASSWORD x.x.x.x COMMAND1
这篇关于将vbscript保存到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文