watchDirectory Help

Help Home
Creating New Tasks
Running Tasks
Task History


Standard versus Pro
Version History


See Also...

Sample Scripts

Free 30 day evaluation!
Standard version: $79 USD
Professional version: $149 USD
Buy Now!


German Helpfile

German Helpfile

French Helpfile

French Helpfile

Spanish Helpfile

Spanish Helpfile

Privacy Policy

Automatically run .bat files

This plugin for watchDirectory automatically starts a .bat file when changes are detected on your file system. You can choose from several predefined .bat files, or create your own. When a .bat file is launched several environment variables are set with information about the file system change.
The following sample scripts are installed:

(Help for other samples will be included in a future release)

Settings for this plugin

Capture Output from .bat files
When checked, all output normally printed to the console will be captured by watchDirectory and written to the Task Directory. These files show you what happens inside the .bat file script, and they prove to be especially useful for debugging problems.
These output files are named outputxxxxx_yyyyy.log, where xxxx is the "run-number", and yyyy is the event-number. These numbers correspond to the run-id and event-id shown into the Task History program.
The output files are automatically removed by watchDirectory after 3 days.
This setting can not be selected if the next option (don't wait for .bat files to complete) is selected.

Don't wait for .bat files to complete
Normally, watchDirectory will wait until the .bat file that is started is done, before it will start another .bat file. If you select this option, watchDirectory will start your .bat file for the next event, even when the first run has not completed yet. Note that enabling this option can cause problems, if any of the following apply:

The problem of the second bullet (busy directory) can be controled by setting a maximum to the number of .bat files allowed to run. See the next setting. This setting can not be selected if the previous option (Capture Output from .bat files) is selected. Also, you can not use the wdAnnotate program if you select this option.

Allow X .bat files at the same time
To prevent hundreds of batch files for this task to run at the same time, you can set a hard upper limit using this option. You can only set this limit if the previous setting is enabled.

Show .bat file Window
If you selected "Don't wait for .bat files to complete", the output window of the .bat file (a command console) will be showed when this option is selected.

Don't give up waiting
If you selected a maximum number of .bat files that are allowed to run, watchDirectory will wait for a .bat file to complete when the maximum is reached. If, after 20 seconds of waiting, still no .bat file has completed, watchDirectory will give up waiting and start the next .bat file. Check this option and watchDirectory will not give up waiting after 20 seconds.

Escape Special characters in variables
Inside batch scripts certain characters (<, >, &, | and ˆ) have a special meaning. When you have files that have these characters in their name, your batch script will not work properly. When you enable this option, watchDirectory will "escape" those characters (by inserting a ˆ) so it will work properly.

The selected .bat file has the following settings
Here you see a list of settings that should be customized for the selected .bat file. These settings depend on the .bat file template you have chosen in the previous step. Below the list is the area where you give a setting its actual value.

If you are starting your own .bat file script, as opposed to using one of the provided scripts, the following topics may prove useful:

Now press next to Configure the Directory to MonitorNext