jacq Posted February 14, 2013 Share Posted February 14, 2013 (edited) Hi When I turn on the cmd via start menu and then enter telnet command works but when I run cmd from the script and then I type telnet and press Enter telnet does not work. Then writes me that does not recognize telnet command. I have telnet service enabled on the system. My code: Run("cmd.exe") WinWait("C:\Windows\system32\cmd.exe", "", 2) ControlSend("C:\Windows\system32\cmd.exe", "", "", "telnet") ControlSend("C:\Windows\system32\cmd.exe", "", "", "{ENTER}") Edited February 15, 2013 by jacq Link to comment Share on other sites More sharing options...
jacq Posted February 15, 2013 Author Share Posted February 15, 2013 Help Link to comment Share on other sites More sharing options...
BrewManNH Posted February 15, 2013 Share Posted February 15, 2013 Run("telnet") If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted February 15, 2013 Author Share Posted February 15, 2013 Run("telnet")Does not work Link to comment Share on other sites More sharing options...
BrewManNH Posted February 15, 2013 Share Posted February 15, 2013 Try it with the full path to the telnet program then, it should work. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted February 15, 2013 Author Share Posted February 15, 2013 Try it with the full path to the telnet program then, it should work.One folder with telnet is a system32 is not working.The other is amd64 ........... with a very long name (a lot of numbers and letters) runs but it does not look like telnet and when i type commands nothing happens. Link to comment Share on other sites More sharing options...
BrewManNH Posted February 15, 2013 Share Posted February 15, 2013 Are you running this as a 32 bit program on a 64 bit OS? If so, this script demonstrates what is going on, it's called File System Redirection, and it affects all 32 bit programs running on a 64 bit OS. #autoit3wrapper_usex64=n ; runs the script in 32 bit program mode _Wow64FsRedirection(False) Run("C:\Windows\System32\telnet.exe") ConsoleWrite('@SystemDir = ' & @SystemDir & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ; revert filesystem redirection for 32 bit process MsgBox(0,"", "click me") ; pauses the script until you press OK _Wow64FsRedirection(True) ; this won't show run Telnet because we turned off redirection. ConsoleWrite(Run("C:\Windows\System32\telnet.exe") & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console ; http://www.autoitscript.com/forum/topic/111647-macro-problem-in-win7-x64/#entry790037 Func _Wow64FsRedirection($state) ; Disables or reverts the filesystem redirector for a 32 bit process running on 64bit OS If Not @AutoItX64 And @OSArch = 'X64' Then If $state Then DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "int", 0) Else DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0); or 1 as per help EndIf If @error Then Return SetError(1) EndIf EndFunc If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted February 15, 2013 Author Share Posted February 15, 2013 Ok thanks. If I run telnet in my program as you do in your code, it will be working on 32 and 64 system or do I have to change things? Do I need to have two versions of the application one at 32 and one 64? Link to comment Share on other sites More sharing options...
BrewManNH Posted February 15, 2013 Share Posted February 15, 2013 If you compile the program as a 32 bit program and use this to momentarily turn off redirection to run the Telnet program, it won't matter which version of the OS it's being run on because it will just ignore the redirection request on a system that it doesn't apply to (x86 OS). #autoit3wrapper_usex64=n ; runs the script in 32 bit program mode ; Use False to disable redirection, it will only apply to the program if running as 32 bit process _Wow64FsRedirection(False) Run("C:\Windows\System32\telnet.exe") _Wow64FsRedirection(True) ; http://www.autoitscript.com/forum/topic/111647-macro-problem-in-win7-x64/#entry790037 Func _Wow64FsRedirection($state) ; Disables or reverts the filesystem redirector for a 32 bit process running on 64bit OS If Not @AutoItX64 And @OSArch = 'X64' Then If $state Then DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "int", 0) Else DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 0); or 1 as per help EndIf If @error Then Return SetError(1) EndIf EndFunc Xandy 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
jacq Posted February 15, 2013 Author Share Posted February 15, 2013 Ok thanks 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