![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | "Shellexecute" telnet Hi, In my script I'm grabbing the contents of a textbox, that contains a hostname and calling it $a. I want to give the user a couple of options with this. Remote desktop to console session:- $i = $textbox1.text; if ($i -ne "") { Invoke-Expression "mstsc /v:$i / console" } works just great. As does ping to the $i host. So I thought I could:- $i = $testbox1.text ; if ($i-ne "") { Invoke-Expression "Telnet $i" } But from what I can see the telnet window spawns then closes immediately. I vaguely remember something about -noexit parameters but can quite put my finger on the syntax used or if that's the right approach? The closest I can get is:- $i = $testbox1.text ; if ($i-ne "") { Invoke-Item "C:\Windows \System32\Telnet.exe" } Which launches telnet fine but I can't seem to find any way to pass along the $i hostname. Or is there a better way to kick off a Telnet session to a string variable datatype? Any advice appreciated as always. Thanks, Stuart |
My System Specs![]() |
| | #2 (permalink) |
| | Re: "Shellexecute" telnet Hi Kryten, if ($i -ne "") { & cmd.exe /K telnet $i 80} /K - Carries out the command specified by string but remains /C - Carries out the command specified by string and then terminates Make sure to pass a port number to telnet as the default port number is 23. --- Shay Levi $cript Fanatic http://scriptolog.blogspot.com K> Hi, K> K> In my script I'm grabbing the contents of a textbox, that contains a K> hostname and calling it $a. K> I want to give the user a couple of options with this. K> Remote desktop to console session:- K> $i = $textbox1.text; if ($i -ne "") { Invoke-Expression "mstsc /v:$i K> / K> console" } K> works just great. As does ping to the $i host. K> So I thought I could:- K> $i = $testbox1.text ; if ($i-ne "") { Invoke-Expression "Telnet $i" K> } K> But from what I can see the telnet window spawns then closes K> immediately. K> I vaguely remember something about -noexit parameters but can quite K> put my finger on the K> syntax used or if that's the right approach? K> The closest I can get is:- K> $i = $testbox1.text ; if ($i-ne "") { Invoke-Item "C:\Windows K> \System32\Telnet.exe" } K> Which launches telnet fine but I can't seem to find any way to pass K> along the $i hostname. K> Or is there a better way to kick off a Telnet session to a string K> variable datatype? K> K> Any advice appreciated as always. K> K> Thanks, K> K> Stuart K> |
My System Specs![]() |
| | #3 (permalink) |
| | Re: "Shellexecute" telnet Thanks Shay, that does work from the ps command line but for some reason my app didn't like it causing it to go 'not responding'. Weird. I settled on:- { $tel = $textbox1.text; $f = New-Object -com wscript.shell $f.run("Telnet.exe $tel") } Thanks! Stuart |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Unwanted Multiple contacts in "To","CC","BCC" of email send catago | Vista mail | |||
| cygwin fails on Vista and Win Enterprise only, telnet "switching to user andy failed" | Vista security | |||
| Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" | Vista General | |||
| How can I add the icons "Delete", "Cut", "Copy" and "Paste" in Vis | Vista file management | |||
| WM5 Sync with Vista "Windows Calender", "Contacts", and "Mail" | Vista General | |||