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
WD_INSTDIR Environmental Variable (Read 3269 times)
Verne
Junior Member
**
Offline



Posts: 50
WD_INSTDIR Environmental Variable
Jan 27th, 2015 at 8:53pm
 
I am using the Run Any .Bat file plugin and the WD_INSTDIR Environmental Variable is not expanding to the install path of Watch Directory.  It outputs blank in the batch file.
Back to top
 
 
IP Logged
 
Verne
Junior Member
**
Offline



Posts: 50
Re: WD_INSTDIR Environmental Variable
Reply #1 - Jan 27th, 2015 at 9:03pm
 
If I use the Start Any Program plugin and tell it to run CMD.EXE and pass these arguments (/C mybatfile.bat) to cmd.exe then the variable expands to the install path of Watch Directory.

Using WD 4.8.8 on Windows 2008 server.
Back to top
 
 
IP Logged
 
Verne
Junior Member
**
Offline



Posts: 50
Re: WD_INSTDIR Environmental Variable
Reply #2 - Jan 27th, 2015 at 9:12pm
 
just testing with a simple batch file
Code:
echo off

ECHO WD BASE FILE NAME: %WD_FILE_N%

ECHO WD FILE is: %WD_FILE%

ECHO WD INSTALL PATH: %WD_INSTDIR%

pause 



Output using Run Any Bat file.
Code:
C:\Windows\System32>GOTO :StartOfBat
annotate not available when not waiting for .bat file info "Starting E:\BatchFil
es\DELBatchTest.bat for event"

C:\Windows\System32>Call "E:\BatchFiles\DELBatchTest.bat" FILENEW
WD BASE FILE NAME: asdfasdfasdf.txt
WD FILE is: E:\JOSHTEST\asdfasdfasdf.txt
WD INSTALL PATH:
Press any key to continue . . . 



Output using Start Any Program
Code:
WD BASE FILE NAME: asdfasd.txt
WD FILE is: E:\JOSHTEST\asdfasd.txt
WD INSTALL PATH: C:\Program Files (x86)\watchDirectory
Press any key to continue . . . 

Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: WD_INSTDIR Environmental Variable
Reply #3 - Jan 28th, 2015 at 9:24am
 
Thanks for reporting that Verne. I will have a look at the code and fix this for the next release.
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
 
Verne
Junior Member
**
Offline



Posts: 50
Re: WD_INSTDIR Environmental Variable
Reply #4 - Jan 29th, 2015 at 12:19am
 
I hope that is soon.  I am being forced to migrate to Windows 2008 server from 2003 server.  We use WDrun.exe in a lot of batch files to stop and start other tasks.  Mostly Quiet tasks that wait for output from another job that was launched from WD.

Lucky for me my predecessor hard coded the path to WD in all the batch files.  Otherwise that would have been a big problem for our current production.  But it is still a problem as now I have to go a change a couple dozen batch files to the (x86) Program Files path when we move these two servers to Windows 2008.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: WD_INSTDIR Environmental Variable
Reply #5 - Jan 29th, 2015 at 6:32am
 
Hello Verne,

I have just looked at the code and see that the WD_INSTDIR variable is not set when you let the task NOT wait for the bat file to complete. This is fixed for the next release.

An easy fix you can apply now is to create a System Environment Variable named WD_INSTDIR. After a reboot this variable will be available to all scripts.

Another alternative...
Select the menu "Tools -> Explore Task Directory", this opens Explorer inside the folder where WD stores all its settings.
If there is a file present called wdglobal.bat, edit it with notepad. If it is not there, create it.
If the "run bat file" task sees this file, the following happens:
* the task sets the variable WD_REALBATFILE to the bat script configured
* the task calls wdglobal.bat, instead of the configured script
So you can do something like this:
Code:
SET WD_INSTDIR=C:\Program Files (x86)\WatchDirectory
Call "%WD_REALBATFILE%"
 


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: 2224
The Netherlands
Re: WD_INSTDIR Environmental Variable
Reply #6 - Jan 29th, 2015 at 7:44am
 
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
 
Page Index Toggle Pages: 1