|
Answer» Hi All
Need to ask a few questions relating to telnet and logging data output within a bat file. Im USING win23k cmd prompt. I am unable to use any other applications like perl,vb or other. The servers both use pragma telnet server. OK here goes.
within the bat file i need to: 1. telnet to other pc - ive got this sorted. PC-A telnets to PC-B im using the following REM *** TELNET TOOL *** :setip cls set ip_add= set correct= cls set/P ip_add=Please enter the IP address: cls set /p correct=Was the IP address %ip_add% correct(Y/N): if /I '%correct%' equ 'y' goto offto goto setip
:offto cls telnet %ip_add% REM need the DELAY for the user to input username and password in cmd prompt. rem i tried choice as below, but it didnt work!! CHOICE /N /T 20 /D y>null goto xxx
2. the user will be prompted for user NAME and password, and i need the bat file to wait for the user to input this before continuing. I thought i could use a delay with choice but this doesnt work. so any ideas would be great. 3. i then need to run a few print cmd's dirs that sort of thing after the user has logged into PC-B >i want to have the output of dirs into files and then copy them to PC-A, or just have the files logged on PC-A in the first place. eg dir c:\ >c:\temp\PC_B_dir.txt
Im not worried about security of telnet just need to know the above.
Many thanks in advance JoFor question number 2. Just use set /p And use an if statement to check to see if the user inputted nothing to go back to the previous command.Hi macdad
Thanks for the quick reply.
"For question number 2. Just use set /p And use an if statement to check to see if the user inputted nothing to go back to the previous command."
If using set /p, will this store the users details in a var? as i wouldnt be allowed to do that. when the user telnets it responds with username then password and then domain which is always a carriage return. How do you send a "carriage return/enter"
not great with cmd's, if you could give me an idea how to use the SET /P variable=[promptString] to do that. Many Thanks jo
would this work?
REM *** TELNET TOOL *** :setip cls set user= set password= set ip_add= set correct=
cls set/p user=Please enter your user name: cls set/p password=Please enter your password: cls set/p ip_add=Please enter the IP address: cls set /p correct=Was the IP address %ip_add% correct(Y/N): if /I '%correct%' equ 'y' goto offto goto setip
:offto cls telnet %ip_add% CHOICE /N /T 3 /D y>null echo %user% CHOICE /N /T 3 /D y>null echo %password% CHOICE /N /T 3 /D y>null ECHO/>NUL
goto xxx
Ive put echo %var% but would that send the username and password?
When the user enters his password, pragma automatically puts xxxxx but not sure if using echo will do this, but i will make this into an exe later, so im sure i could hide the password there?
Ive also put pauses in...as the pragma server is always slow to respond, just to make sure. Cheers Jo Ok, i see what you are trying to do, telnet can't pass the password thru in a parameter, but it can the username in a parameter.
Link
But does Telnet bring up a input for password without the echo?
i can't see why you are restricted to use any other tools. If its for your work and part of the business, you might want to encourage your boss to ALLOW it to make things easy and productive. Windows Telnet client is not suited for batch use, period. hi macdad
Had a test with your idea, it brings up a prompt for the user and thats it... the batch stops.
also the -a and -f parameters in telnet wont work.
Any other ideas??
Cheers JoLike Ghostdog said,
Telnet is not suited for Batch use.
You should look for a 3rd party telnet client for batchin my office, use Pragma telnet server, can i login into telnet with username and password parameter? how? Telnet can't accept usernames and passwords, try another 3rd party program
|