Unable to spawn telnet session from TCL script with Expect on Windows XP Professional

Posted by Bharat Shah on 2008-01-08 17:18

I was using ActiveTcl Ver 8.4.14 with my older PC with Windows XP Ver 5.1.
I just got new PC with Windows XP professional Ver 5.1 as well.
I am using "package require Expect" at the begining of my script.
I loaded ActiveTcl Ver 8.4.14 and script died at the following command.

set pid [spawn telnet 192.168.1.1 23]

I loaded ActiveTcl Ver 8.4.17 and same issue.
ActiveTcl Ver 8.5.0.0 does not contain Expect package and useless for me.

I nedd help. Does anyone know what's going on?

Thanks.

Vamsi Krishna | Wed, 2008-01-09 23:13

Hi,
I wrote some functions in C. To create Tcl my own commands. Now I want to combine these Tcl commands with my gui{which has been created in TK}. Can you please suggest me how to combine?

Thanks and Regards
Vamsi Krishna. M

mstinaff | Fri, 2008-02-22 13:24

I have the same issue as well. I tried 8.5 and then ran teacup -install Expect. same fail. The exact error I get is:
The exception unknown software exception (0xc0000409) occurred in the application at location 0x59a7295d.

this is the same error and location if I use 8.5 or 8.4. Both versions of Expect are 5.43 though.

catalinmy | Fri, 2008-02-22 14:46

And to me, TCL crash after: shawn ping 192.168.0.1 . I have Windows XP SP2 and Active TCL 8.4.11 (Expect are 5.43).

weyersjj | Sat, 2008-04-12 02:39

See link:
http://support.microsoft.com/kb/875352
Choose the OptOut mode:
Explanation:
DEP is some kind of protection. You can exclude applications from this protection by adding this applications (telnet, ftp etc.) to that list.
Yust start your configuration tool in XP choose the classic gui->system-> advanced->Dutch: Prestatie/English:?->(Dutch: Instellingen: English: Configuration/Preferences?)->*Dep* and add your programs to the list.
Reboot the computer.

sschen | Mon, 2008-04-14 13:44

This is the solution:
Modify the c:\boot.ini file as
"/noexecute=AlwaysOn"

It will allow to spawn the process.

nelsonrherron | Thu, 2009-11-19 14:12

Unable to spawn telnet session from TCL script w/ Expect on Vista. Same problem on Vista. Code:

puts "Hello, World\n";
set x 3;
puts $x;
package require Expect;
puts "Hello, World\n";
set x 4;
puts $x;
spawn telnet 192.168.1.1

Error:

C:\Utilities\tcl>tclsh85 test.txt
Hello, World

3
Hello, World

4
The system cannot find the file specified.
while executing
"spawn telnet 192.168.1.1"
(file "test.txt" line 8)

C:\Utilities\tcl>
C:\Utilities\tcl>

kutik | Tue, 2010-01-05 04:43

Telnet is disabled by default installation in Vista.
Enable it via Control Panel or use
'pkgmgr /iu:\"TelnetClient\'

ttapping | Thu, 2010-01-14 10:23

I see the same issue as reported above. Telnet is installed and I can launch via CMD.

Open a Wish85 Console and type:
% package require Expect
Response: 5.43
% spawn telnet 10.35.0.233
Response:The system cannot find the file specified

I saw posts that DEP might prevent this from working, although 'spawn ftp' works fine. I ran "bcdedit.exe /set nx AlwaysOff" from the command line and it completed successfully. I rebooted but still can't 'spawn telnet'.

Anyone have an idea how to fix this?

Thanks in advance.

Tim

ttapping | Fri, 2010-01-15 09:02

Got another box, installed Win XP SP3 32 bit and installed tcl.

Ran 'spawn telnet' and it worked like salmon returning to their home stream! :D

peter2008 | Sun, 2011-02-06 07:09

I did it.
It seems that spawn cannot work with telnet shipping with 64bit version windows 7, but it can work with the telnet shipping in windows xp. So replace the win 7 telnet with xp telnet would be ok.

I have tried it and it works. Bingo!

juls858 | Fri, 2011-06-10 11:38

I've tried this and could not get it to work on Windows 7 x64.
I've copied a 32bit telnet.exe from a windows XP box and get "spawn cannot find the file specified" error.

I've even tried exluding telnet.exe from DEP.

Could you tell us exactly how you got this to work?

Thanks

gunns | Sun, 2011-06-19 17:32

Use "plink.exe" instead of telnet.

Ex. spawn plink -telnet 127.0.0.1

Available from: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

hareesh | Mon, 2014-04-28 06:48

I am getting in to tclsh crash when spawn telnet session on win8.1, Win8.I had experience the same issue in Win7 as well, but this issue was not seen after Disabling Data Execution Prevention using command “ bcdedit /set nx AlwaysOff ”.
TCL 8.4
% package require Expect
5.43.2
% spawn telnet 192.168.1.1
628
%
-->> crash seen
================================================================================
Faulting application name: tclsh.exe, version: 8.4.2.19, time stamp: 0x4f32d408
Faulting module name: dbghelp.dll, version: 6.3.9600.16384, time stamp: 0x52157b79
Exception code: 0xc0000005
Fault offset: 0x000c718a
Faulting process id: 0xe60
Faulting application start time: 0x01cf62ed2bb416ab
Faulting application path: C:\TCL\bin\tclsh.exe
Faulting module path: C:\Windows\system32\dbghelp.dll
Report Id: 760c1370-cee0-11e3-971b-0050b6574c32
Faulting package full name:
Faulting package-relative application ID:
================================================================

Anyone have an idea how to fix this?

Thanks in advance.

Hareesh