WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Executing a batch file placed in directory (Read 3941 times)
Voltorb
YaBB Newbies
*
Offline



Posts: 3
Executing a batch file placed in directory
Apr 19th, 2012 at 10:51pm
 
I want to use WatchDirectory to monitor for .bat files deposited in a directory, and execute them.  Can't seem to get it to execute them.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Executing a batch file placed in directory
Reply #1 - Apr 20th, 2012 at 7:26am
 
Hi,

Here is what you should do. Create a new bat file (for example called C:\Bin\StartBat.bat) with the following contents:
Code:
Call "%WD_FILE%"
 



The variable WD_FILE has the full name (including path) of the detected file (see http://www.watchdirectory.net/wdhelp/plugins/wdopAutoRunBatEnv.html ). The newly created bat file in your case.

Should work fine.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Executing a batch file placed in directory
Reply #2 - Apr 20th, 2012 at 7:27am
 
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Voltorb
YaBB Newbies
*
Offline



Posts: 3
Re: Executing a batch file placed in directory
Reply #3 - May 1st, 2012 at 9:16pm
 
I configured exactly as in the blog post above, except I issue a move to move the .bat file to a history folder.  Here's my code:

@echo off
Call "%WD_FILE%"
Move "%WD_FILE%" C:\DigitalHot\History\

The move is executed, but the batch file is not processed.  I can double click the batch file, and it works that way.  Any ideas?  I'm running WD on a Windows Server 2003 machine.

Thank you!
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Executing a batch file placed in directory
Reply #4 - May 1st, 2012 at 9:30pm
 
Just a guess... You are running the WD task as a Windows Service?
Try to run the task "normally" first (not as a Windows Service).

Also see this blog: http://blog-en.gdpsoftware.com/2010/04/watchdirectory-tasks-as-windows-service.h...

Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Voltorb
YaBB Newbies
*
Offline



Posts: 3
Re: Executing a batch file placed in directory
Reply #5 - May 1st, 2012 at 9:35pm
 
Yes, I was running as a service. 

Works like a charm now!  Thank you VERY much!
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1