autoit0822 Posted April 25, 2010 Posted April 25, 2010 (edited) In Vista, I was able to run a script from D:\ and have Run("cmd.exe") open the command prompt for me to open a telnet session. In 7, the script tries to telnet from D:\. How can I get the script to telnet from where it should, regardless of where it is located? I've tried @ComSpec, and using @SystemDir as the working directory. Edited April 27, 2010 by autoit0822
GEOSoft Posted April 25, 2010 Posted April 25, 2010 http://www.leateds.com/2009/telnet-for-windows-vista-windows-7/ George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
darkjohn20 Posted April 25, 2010 Posted April 25, 2010 I don't think this what he was looking for? I could be wrong, but it seems like he already has Telnet, but it's trying to work from a different drive?
ProgAndy Posted April 25, 2010 Posted April 25, 2010 Windows 7 does not include telnet.exe by default. You have to install it first. The article describes how to do that.Also, the command should be Run(@SystemDir & "\the_app.exe") *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
GEOSoft Posted April 25, 2010 Posted April 25, 2010 I don't think this what he was looking for? I could be wrong, but it seems like he already has Telnet, but it's trying to work from a different drive?Whether or not it's what he was looking for, the odds are that it's the solution to the problem. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
autoit0822 Posted April 27, 2010 Author Posted April 27, 2010 (edited) I have no trouble opening a command prompt manually and running telnet from there; I just can't get it to work in an AutoIt script. If I run("cmd.exe") or run(@ComSpec) or run(@ComSpec & " /k" & @SystemDir & "\telnet 192.168.1.1","") (and @SystemDir wrongly points to C:\Windows\SysWOW64 anyway), the script fails. It seems the only way I could possibly run the script is from C:\Windows\System32; but I'm hoping that others are using Windows 7 (64-bit) and have figured out a way around this problem. Edited April 27, 2010 by autoit0822
GEOSoft Posted April 27, 2010 Posted April 27, 2010 (edited) (and @SystemDir wrongly points to C:\Windows\SysWOW64 anyway) Invalid assumption. For 64 bit SysWOW64 is @SystemDir. Stop thinking that System32 has always been and will always continue to be the system dir because neither assumption is correct. At one time the System dir was C:\Windows\System. For backward compatability with some software that folder was left in System32 became the the system dir. Now with 64bit it's changed again but again for compatability reasons the others are left in place. I must admit, it's been a long time since I saw an installer that actually placed files in Windows\System\ Try Run(@ComSpec & " /k " & @WindowsDir & "\system32\telnet 192.168.1.1","") You were also missing a space after the /k Edit: Probably not but you might have to also change telnet to telnet.exe Edited April 27, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
autoit0822 Posted April 27, 2010 Author Posted April 27, 2010 I tried your suggested code, both with and without .exe and a space after the /k, but it's still not recognising telnet.
GEOSoft Posted April 27, 2010 Posted April 27, 2010 Run this and post the results MsgBox(0, "TEST", FileExists(@WindowsDir & "\system32\telnet.exe")) Also try this $sFile = FileGetShortName(@DeskTopDir) & "\tstreslt.txt" Run(@Comspec & " /k " & @WindowsDir & "\system32\telnet 192.168.1.1 > $sFile","") AnyThing in the file? Next $sFile = FileGetShortName(@DeskTopDir) & "\tstreslt.txt" $sErr = "" $Run = Run(@Comspec & " /k " & @WindowsDir & "\system32\telnet 192.168.1.1","", @SW_MAXIMIZE, 0x4) While ProcessExists($Run) $sErr = StderrRead($Run) WEnd MsgBox(0, "Test", $sErr) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
99ojo Posted April 27, 2010 Posted April 27, 2010 Hi, have you checked, where your telnet.exe is installed? I just install the telnet client on Win 7 64 Bit Ultimate. My InstallDir is @WindowsDir & "\winsxs\amd64_microsoft-windows-telnet-client_31bf3856ad364e35_6.1.7600.16385_none_1426830c3ebb712d I copied the file into @WindowsDir & \system32 and the code is running with autoit: Run(@ComSpec & " /k " & @WindowsDir & "\system32\telnet.exe 192.168.1.1","") ;-)) Stefan
autoit0822 Posted April 27, 2010 Author Posted April 27, 2010 First test: result is "0". Second: telnet is not recognised. Third: empty dialog box. Stefan: my telnet is located in C:\Windows\System32; the problem I'm having is that an AutoIt script can't run outside this location.
GEOSoft Posted April 27, 2010 Posted April 27, 2010 well, you forced me to install it (now to get it uninstalled cleanly I hope i have a good restore point). It didn't work here either and this showed me why ShellExecuteWait("telnet.exe", "192.168.1.1") It's not connecting because port 23 isn't open and I'm not about to open it for something I'm removing anyway. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
MHz Posted April 27, 2010 Posted April 27, 2010 Have a look at the page in the help file titled Running under Windows 64-bit EditionI am guessing that you are running 32bit AutoIt on a 64bit OS and thus the filesystem redirection is occurring. You will notice a DllCall on the help file page above which disables the redirection. That should help telnet to run from your script.I also answered a similar problem here and supplied a UDF for the filesystem redirection handling.
99ojo Posted April 27, 2010 Posted April 27, 2010 (edited) Hi, check your path variable and be sure that telnet.exe is really in system32 folder. My telnet.exe is located in c:\windows\system32. If i run MsgBox(0, "TEST", FileExists(@WindowsDir & "\system32\telnet.exe")); this shows me !!! 1 !!! -> file is in folder Run(@ComSpec & " /k " & "telnet.exe 192.168.1.1","c:\temp") telnet starts and try to connect 192.168.1.1. ;-)) Stefan @Edit: I'm running 32 Bit Autoit on 64 Bit Win 7 Edited April 27, 2010 by 99ojo
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