Created
February 6, 2019 07:52
-
-
Save jarnaldich/edb73c7f0604a6e1de7f7b7cb1b8031a to your computer and use it in GitHub Desktop.
Powershell File System Watcher #powershell #watch #filesystem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$w = New-Object System.IO.FileSystemWatcher | |
$w.Path= pwd | |
$w.Filter= "*.py" | |
$w.EnableRaisingEvents = $true | |
$action = { (&{ cls; $p = $Event.SourceEventArgs.FullPath; python $p }) 2>&1 | Write-Host } | |
$changed = Register-ObjectEvent $w "Changed" -Action $action | |
Unregister-Event $changed.Id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment