Hello All,
Is it poossible to achieve directory watcher event through dos script
E.g - I have dir say A if some text file is comes in this directory the an event should get raised
like if a.txt file comes in dir A the test.batch file shoulde get run. And there is no fix time for a.txt it will come any time in dir A.
how can we achieve it through dos script.
Is it posibl to achieve Directory watcher event
Moderator: DosItHelp
-
- Posts: 5
- Joined: 10 Sep 2009 22:53
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
**UNTESTED**
You can add /wait after the word start if you want to wait for the other program to finish before continuing.
Code: Select all
@echo off
set "watchdir=c:\tmp"
set "watchfile=notify.txt"
set "eventprog=c:\mybatchfile.cmd"
::Could use wildcards like set "watchfile=*.txt"
:loop
if exist "%watchdir%\%watchfile%" start "%eventprog%" cmd /c "%eventprog%"
ping -n 2 -w 800 127.0.0.1 >nul 2>nul
goto :loop
-
- Posts: 5
- Joined: 10 Sep 2009 22:53
Thanks avery_larry
Thank you avery_larry
I tested it , Its working fine only the thing is when I run batch file that dos window is appear can we hide it (Is it possible to run it at back end).
I tested it , Its working fine only the thing is when I run batch file that dos window is appear can we hide it (Is it possible to run it at back end).