0

I want to connect on a remote server and copy a folder that is in location C:\vrs and to rename it with the name and sysdate.`

The script is :

telnet 10.194.32.xxx copy C:\vrs\vsn C:vrs\vsn_bkup_%Date:~-10,2%_%Date:~-7,2%_%Date:~-4,4% exit 

But the issue is that when is connecting on IP, I receive the following question:

you are about to send your password information to a remote computer in Internet zone. This might not be safe. Do you want to send it anyway? 

I have to answer yes, but will not follow the next steps from my bat file. Can I automate the answer "y" with a new line on the script?

P.S. Neither echo y| telnet ip nor echo y.txt file work

Any idea? (The server where I want to connect via telnet is Windows 2003 Server R2)

Thank you in advance!

3
  • did you try another telnet client ? PUTTY might be a good choise ... Commented Aug 6, 2014 at 10:22
  • what is the title of the window where the Y needs to be sent. Once we know that, we could in theory issue the sendkeys command from batch via powershell one-liner, kinda like this example - superuser.com/questions/696467/… ---- otherwise, I was thinking of adding that 10.194 host to a more trusted zone which may or may not suppress that dialog. Commented Aug 6, 2014 at 10:46
  • you can check this scriptable telnet tool: ss64.net/tst10.zip Commented Aug 6, 2014 at 12:22

2 Answers 2

1

Windows telnet.exe is not scriptable and it doesn't give you that error message either AFAICS.

Telnet Scripting Tool v.1.0 by Albert Yale is a free scriptable Telnet client.

To copy a file from a PC on the local LAN then you would use something like this:
(using %date% is unreliable as the date format can change from PC to PC)

copy "\\server\share\file.txt" "c:\vrs\vsn_bkup_%Date:~-10,2%_%Date:~-7,2%_%Date:~-4,4%" 

To copy a file from the internet you need other techniques.

Sign up to request clarification or add additional context in comments.

1 Comment

Hello foxidrive, I don't want to copy a file from pc on the local, I want to connect on the ip like in example and there to make a backup of a file and after rename the backup folder with the date.
0

You might want to disable NTLM authentication and switch to use only password authentication, for this use tlntadmin command: tlntadmn config sec=-NTLM (you need to be admin on server for this of course)

3 Comments

This worked!Thanks a lot! But now, I have to automate the script to enter the password itself..for user I typed : telnet -l user ip ..but for password?
i would not pass password directly, you could use something like send/expect commands for this inside your script
I want to pass the password with my input on the line command because the security it s not a problem..

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.