jeris Posted December 19, 2011 Share Posted December 19, 2011 <I'm using SciTE Version 1.78 on Windows XP> I'm trying to create a simple script to run from a Windows XP terminal. The Script opens a command window and starts up telnet in order to define a telnet log file. Then it uses telnet to open a session on an external server, run a command and shut it down. At this point, I try to use the telnet escape sequence (CTRL+]) to return to the telnet session and open another session with an iBootBar, which will power-cycle the server. I also try to use the escape sequence in the iBootBar session to return to the Telnet session. Neither of the escape sequences seem to work. Can anyone tell met what I've got wrong with the escape sequence? The simplified script (minus some sleeps, etc) is: Const $logName = "someFile" Const $SvrIpAddr = "192.168.12.34" Const $iBootBarIpAddr = "192.168.56.78" Run("cmd") Send("telnet {ENTER}") Send( StringFormat ('set logfile %s ', $logName & "{ENTER}" ) ) Send( StringFormat ('open %s ', $SvrIpAddr & "{ENTER}" ) ) ;at this point the telnet session is opened on the server Send("Username" & "{ENTER}") Send("password" & "{ENTER}") Send("some command" & "{ENTER}") Send("shutdown -s {ENTER}") Send("^{]}") ;start comment Here is where I thought it should return to the telnet session but the session window indicates that "connection to host is lost" and continues with the C: prompt on the server... ;end comment Send( StringFormat ('open %s ', $iBootBarIpAddr & "{ENTER}" ) ) ;at this point, a telnet session opens on the iBootBar Send("Username" & "{ENTER}") Send("password" & "{ENTER}") Send("set outlet 1 cycle" & "{ENTER}") ; at this point, the server is power-cycled Send("^{]}") ;start comment The prompt is stuck in the iBootBar - it doesn't return to the telnet session. From the iBootBar prompt, I have to enter CTRL+], which returns the window to the telnet session and then I have to manually "quit" telnet and "exit" the command window. Any suggestions? (I want to be able to loop through this 1000 times before exiting the telnet and cmd sessions so that everything gets logged in the telnet logfile...) ;end comment Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now