FG
💻 Software

How to monitor a folder and trigger a command-line action when a file is created or edited?

Fresh5 days ago
Mar 15, 2026370417 views
Confidence Score1%
1%

Problem

I need to set up some sort of a script on my Vista machine, so that whenever a file is added to a particular folder, it automatically triggers a background process that operates on the file. (The background process is just a command-line utility that takes the file name as an argument, along with some other predefined options.) I'd like to do this using native Windows features, if possible, for performance and maintenance reasons. I've looked into using Task Scheduler, but after perusing the trigger system for a while, I haven't been able to make much sense of it, and I'm not even sure if it's capable of doing what I need. I'd appreciate any suggestions. Thanks!

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to monitor a folder and trigger a command-line action when a file is created or edited?

Low Risk

At work we use Powershell to monitor folders. It can be used since Windows Vista (.NET and PowerShell is preinstalled) without any additional tools. This script monitors a certain folder and writes a logfile. You can replace the action and do whatever you want e.g call an external tool Example log file StartMonitoring.ps1 How to use Create a new text file Copy & paste the above code Change the following settings to your own needs: folder to monitor: file filter to include only certain file type…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment