I have a need to execute a batch file when I drop it into a specific folder of one of my Windows PCs.
We have 20 PCs spread out thruout the US. I can remote into each PC and execute the batch file on the local PC but that takes a long time.
I can also do a file transfer into each of these PCs very quickly. If I can get the batch file to execute once it is placed in a specific folder that would solve my problem.
I've heard of listeners in the past. Where "something" on the PC is just looking at the contents of a folder. If a file happens to exist in that folder the listener executes "something".
Here's some pseudocode to help get a better understanding:
\\Program watches the contents of C:\Folder1
If
file batchfile.bat exists in C:\Folder1
then execute batchfile.bat and then delete batchfile.bat
Else
continue watching C:\Folder1 for batchfile.bat
I'm digging around SO and looks like PowerShell is going to be the path I need to take. Do you guys agree or is there a more efficient solution?