

$ChangeInformation | Out-String | Write-Host -ForegroundColor DarkYellow # define a function that gets called for every change: # specify the maximum time (in milliseconds) you want to wait for changes: #$ChangeTypes = ::Created, ::Deleted, ::Changed # specify the type of changes you want to monitor: $AttributeFilter = ::FileName, ::LastWrite # specify the file or folder properties you want to monitor: # specify whether you want to monitor subfolders as well: # specify which files you want to monitor # specify the path to the folder you want to monitor: Would it be possible to check several different paths RE: check multiple files (Moved the Post from VBScriptto here) mikrom (Programmer) 18 Feb 21 11:01ĬODE -> Powershell # find the path to the desktop folder: When i use the Notepad.exe and after i change the file and i go to File Save -> i get only 1 Message! I changed the Files with Notepad++ and press Ctrl-S or the Save Button -> i get 2 Messages. You postet an NEW Message and THIS was the solution!! I change one File and save it -> i get 2 messages.Īfter this i Stop the script and change the same File again and no Picture or new entry in the Logfile. I open the Powershell console and run the script. $logline = "$(Get-Date), $changeType, $path"Īdd-content "C:\tmp\FileWatcher_log.log" -value $logline RE: check multiple files (Moved the Post from VBScriptto here) mikrom (Programmer) 18 Feb 21 09:05ĬODE -> Powershell # define actions after an event is detected Id Name PSJobTypeName State HasMoreData Location Command p Ping a Hyper-V Network Virtualization provider address. c compartment Routing compartment identifier. Per RFC 5095 the use of this routing header has beenĭeprecated. R Use routing header to test reverse route also (IPv6-only).

w timeout Timeout in milliseconds to wait for each reply. k host-list Strict source route along host-list (IPv4-only). j host-list Loose source route along host-list (IPv4-only). s count Timestamp for count hops (IPv4-only). r count Record route for count hops (IPv4-only). This setting has been deprecatedĪnd has no effect on the type of service field in the IP f Set Don't Fragment flag in packet (IPv4-only). n count Number of echo requests to send. To see statistics and continue - type Control-Break t Ping the specified host until stopped. Filter = $filter # include subdirectories $true/$false $filewatcher.IncludeSubdirectories = $true $filewatcher.EnableRaisingEvents = $true # define actions after an event is detected $writeaction = RE: check multiple files (Moved the Post from VBScriptto here) mikrom (Programmer) 17 Feb 21 16:44 # folder and file types to monitor $path = "c:\tmp\" $filter = "*.txt" $filewatcher.Path = $path $filewatcher.
#FILEWATCHER STOPPED WORKING CODE#
CODE $filewatcher = New-Object System.IO.FileSystemWatcher
