I have a simple script which runs a bat file, which opens up a telnet session to a box and port, dumps the output to a logfile and then closes the connection, discussed in the following article: 27238825.However the only way to close it due to various issues is to grab the DOS window and do a SendKey of CTRL + ] and then a sendkey of quit, then enter.
This works fine when the telnet session is opened normally however there is a flaw. If the user clicks onto a separate window whilst the command is running, the sendkeys go to that window and dont close the telnet session. I would ideally like the DOS screen to be hidden or minimised so users don't see it. To do that I would need to grab the window manually I guess and then do the sendkeys thing. My script is below
newLog = 1
for i = 1 to 10
newLog = newLog + 1
sCmd = "monitorSS.bat "
Set oShell = CreateObject("WSCript.shell")
oShell.Run sCmd & logNo
set oShell = nothing