2

I have in C:\files\ for example the following files:

apple.txt
orange.doc
banana.exe
kiwi.avi

And I place e.g. mango.exe in there.

What script or technique can I use to be notified immediately of the change to this folder and to open the file immediately?

Mofi
  • 46,139
  • 17
  • 80
  • 143
mojamoja
  • 23
  • 2

2 Answers2

1

For a batch file, this answer may help:

batch file to monitor additions to download folder

You would need to extend the solution there yourself to launch the detected changes.

In C# this can be done quite easily. This question: How can I monitor a Windows directory for changes? is similar.

Community
  • 1
  • 1
xan
  • 7,440
  • 8
  • 43
  • 65
  • Thanks man you made my day ;) I got: @echo off if not exist c:\OldDir.txt echo. > c:\OldDir.txt dir /b "d:\My Folder" > c:\NewDir.txt set equal=no fc c:\OldDir.txt c:\NewDir.txt | find /i "no differences" > nul && set equal=yes copy /y c:\Newdir.txt c:\OldDir.txt > nul if %equal%==yes goto :eof rem Your batch file lines go here – mojamoja Dec 09 '11 at 15:48
  • Actually, how do I run it? I still can't see how this script knows that mango.exe is the new one? – mojamoja Dec 09 '11 at 16:22
0
move \wherever\mango.exe c:\files\mango.exe
start mango.exe
Marc B
  • 356,200
  • 43
  • 426
  • 500