Is there any simple way(i.e., script) to watch file in Powershell and run commands if file changes. I have been googling but can\'t find simple solution. Basically I run scr
You can use the System.IO.FileSystemWatcher to monitor a file.
$watcher = New-Object System.IO.FileSystemWatcher $watcher.Path = $searchPath $watcher.IncludeSubdirectories = $true $watcher.EnableRaisingEvents = $true
See also this article