By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Getting data to the command line

P: 3
I need to get the value of a field in form to a command line and append it after the telnet command. Is this possible?
For example, the field IP_Address value to be appended to:
telnet "value"
I have created a command button that launches the telenet window but don't know how to extract the data and use it here.
Sorry for the lack of knowledge in this area, I inherited this project.
Thanks in advance for any help,

Skip
Jan 3 '07 #1
Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,492
For things like Telnet & FTP you need to create a response file with the parameters required.
What code are you using to start this off? The Shell() function?
Actually, it would be a good idea to go ahead and post your current code.
Jan 4 '07 #2

P: 3
Here is what I have based on some guidance from another site.
The field that holds the data I want is called IP_Address.
The goal is to launch telnet, and grab the IP address from the field on the form and append it to the CLI.
If I use stAppName = "telnet" only it launches the telent window as expected.
but using the method below it just flashes the dos screen which indicates to me that the IP_Address info is not being appended.
What do you think?
Thanks for the help,
Skip


Private Sub TelnetToAP_Click()
On Error GoTo Err_TelnetToAP_Click

Dim varReturn As Variant
Dim stAppName As String

stAppName = "telnet /" & IP_Address
Debug.Print stAppName

'Call Shell(stAppName, 1)
varReturn = Shell(stAppName & "", 1)
Debug.Print varReturn

Exit_TelnetToAP_Click:
Exit Sub

Err_TelnetToAP_Click:
MsgBox Err.Description
Resume Exit_TelnetToAP_Click

End Sub
Jan 4 '07 #3

NeoPa
Expert Mod 15k+
P: 31,492
Looking at the help for telnet (telnet /?)...
telnet [-a][-e escape char][-f log file][-l user][-t term][host [port]]
-a Attempt automatic logon. Same as -l option except uses
the currently logged on user's name.
-e Escape character to enter telnet client prompt.
-f File name for client side logging
-l Specifies the user name to log in with on the remote system.
Requires that the remote system support the TELNET ENVIRON option.
-t Specifies terminal type.
Supported term types are vt100, vt52, ansi and vtnt only.
host Specifies the hostname or IP address of the remote computer
to connect to.
port Specifies a port number or service name.
It seems that it should work if you leave out the / char.
I had no telnet server to test it on but it worked fine without the host as it did for you.
Jan 4 '07 #4

P: 3
Great!
That was it.
I removed the / and left a space i.e. "telnet " & IP_Address
and it works perfectly.
Thanks to all for the help!
skip
Jan 5 '07 #5

NeoPa
Expert Mod 15k+
P: 31,492
NP - Pleased to help :)
Jan 5 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.