Sign in to follow this  
Followers 0
foster74

Is there a command to wait to write to a file?

2 posts in this topic

I have a file that is being wrote to and read from constantly by many instances of a single script. This is causing it to error out every so often, I have look around a ton and can't find anything. Is there anyway around this? And if not, I was planning on making a script that uses TCP that will allow all the scripts access to the file one at a time. Would this be my best choice? There is no way I can work around using a single file, so any input is much appreciated, thanks in advance.

-Casey

Share this post


Link to post
Share on other sites



Here you go...

CODE
Do

$errfile = FileOpen($path,1)

Sleep(500)

Until $errfile <> -1

FileWriteLine($errfile,@ComputerName & " -> " & $NewOU & ": Move Result: " & $moveresult)

FileWriteLine($errfile,@ComputerName & " -> " & $newname & ": Renm Result: " & $renresult)

FileClose($errfile)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0