Click to See Complete Forum and Search --> : Ping instruction


visual fzz
January 21st, 2000, 07:45 AM
Hi everybody

I want to make a little program which will make a ping to a server at the dos prompt and which will indicate if the ping works.
My question is : How can I know if the ping works???

More generally, how can I get the information in the dos windows?
Ex : I got an environmental variable called MYVAR
If I enter "set MYVAR" at the dos prompt, How can I get the information ??

Thanx

Fzz

Bruno
January 21st, 2000, 12:04 PM
option Explicit

private Sub Form_Click()
Dim sCommand as string, i as Integer
' execute command
sCommand = "Ping "
Shell "command.com /c " & sCommand & " > c:\info.txt"
' wait
for i = 1 to 10000
DoEvents
next
' show file
Shell "notepad c:\info.txt", vbNormalFocus
End Sub