How can I force a Powershell script to wait overwriting a file until another process is finished reading it?
问题 Imagine that I have a shared folder MyShared: User A, gets the file \MyShared:\Foo.txt after every 30 seconds. And I overwrite \MyShared:\Foo.txt also after every 28 seconds (within my PowerShell script) How can I prevent myself to overwrite this file while the user is getting it, in PowerShell? (I do not want to break the content of the file or end-up with some error by attempting to overwrite it in the time of user retrieving it) If I rephrase the question : How can I force a Powershell