Hi,

This runs the ping command and outputs the result to a text file called "Local Host.txt"

Code:
        Shell("cmd /c ping 127.0.0.1 >C:\""Local Host.txt""", vbHide)
How can I know if the file exists or not/ the command has been executed or not so that the next piece of code can be executed?
PS: The next piece of code depends completely on the files, without it it is useless

I tried this:

Code:
        While IO.File.Exists("C:\Local Host.txt") = False
            Me.UseWaitCursor = True
        End While

but, the next line of code gives me an error saying:

The process cannot access the file 'C:\Local Host.txt' because it is being used by another process.

PS: What I actually want to do is append certain text to the begining of the file (before the result of the command)