简体   繁体   中英

save vbscript to a file

I have a batch file that contain:

@echo off

start telnet x.x.x.x 5000
cscript 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 " "

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM