Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27346

Append text to begining of text file

$
0
0
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:

Quote:

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)

Viewing all articles
Browse latest Browse all 27346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>