|
-
Jul 14th, 2000, 10:02 AM
#1
Thread Starter
Fanatic Member
How do I run a dos command like
NSLOOKUP
within a VB program and have the program retrieve the output
for example I want to get the IP address of my computer on win NT so I run the dos command
IPCONFIG
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 14th, 2000, 10:12 AM
#2
Addicted Member
I can send you a module that finds the IP using an API. Email me if you want it.
This is a big module (100 lines) I'm not sure it its appropriate to post it. Can anybody advise?
-
Jul 14th, 2000, 10:15 AM
#3
Thread Starter
Fanatic Member
Thanks,
but there are dozens of dos commands that i use frequently. I was looking for a quick way to get there info automatically
THIS IS JUST MY IDEA NOT VB CODE
text1.text = DosShell("192.168.0.1",TimeOutValue)
etc
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 14th, 2000, 03:39 PM
#4
Junior Member
The way i usually do it is to shell the command and append > somefile.txt to the end of the command line. You can then open the text file you created and pull out the data.
cmd = "cmd /c dir > " & app.path & "\dosresult.txt"
-
Jul 15th, 2000, 02:27 PM
#5
Thread Starter
Fanatic Member
I got it to work at the command prompt but
I couldn't get it to work in VB
shell ping 127.0.0.1 > c:\test.txt
correct?
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 15th, 2000, 04:17 PM
#6
Hyperactive Member
You have to enclose the command in quotes.
"People who think they know everything are a great annoyance to those of us who do."
-
Jul 15th, 2000, 05:30 PM
#7
Thread Starter
Fanatic Member
this is my exact vb code
Private Sub Command1_Click()
Dim cmd As String
cmd = "ping 127.0.0.1 > c:\index1.txt"
Shell cmd,vbMaximizedFocus
' max just so I can see what happens
End Sub
but it won't work
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Jul 15th, 2000, 09:24 PM
#8
Lively Member
shell onli excute exes.....
so if you want to ping, you can try [windows folder]\ping.exe instead
YC Sim
Teenage Programmer
UIN 37903254
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|