1.

Solve : send the response of telnet to a file?

Answer»

Hi, I'm new in this forum, it's excellent !
In FIRST time, excuse me for my english, maybe isn't very good.
Now the question:

When I connect to a DAYTIME server:

telnet time-a.nist.gov 13

I RECEIVE the response:

53771 06-02-05 17:17:26 00 0 0 373.1 UTC(NIST) *

I need to send this information to a file. Solution seems easy:

telnet time-a.nist.gov 13 > hora.txt

And use it to change the hour in my computer:

for /f "tokens=3" %X in (hora.txt) do echo %X | time

(I know, I know, I can use NTP or SNTP, that is not the question).

But don't work, the file hora.txt stay empty. Why? :-? :-? :-?

I set the LOCAL_ECHO to ON:

C:\>telnet
Microsoft Telnet> display
EL carácter de escape es "CTRL++"
Se autenticará (autenticación NTLM)
LOCAL_ECHO habilitado (ON)
Enviar ambos CR y LF
Se negociará el tipo de terminal
Terminal preferido: ANSI

but nothing.

I'm use W2000 and W2000 Server. ¿Could any help me?

-many thanks-Telnet sets up a new environment within the command shell and was never meant to be scripted in Windows.

telnet -f time.txt time-a.nist.gov 13

will create a file (time.txt) with the information you need, but you still have to manually hit enter in order for a batch file to proceed. If you use redirection or a filter, the commands will not be passed from one environment to the other.

Good luck. 8-)ups! I read the documentation of W2000 Proffesional, but not of W. Server [smiley=rolleyes.gif]

It don't works in w2000 proff. but it serves to me.

[smiley=dankk2.gif]



Discussion

No Comment Found