Search This Blog

Loading...

Friday, 17 April 2009

Q&A - Run bwavinfo for detected files

Q&A

Adam on our Forum asks:

Q

Hi all,

I'll confess I'm no expert on scripting, but I've had a good deal of success in running simple batch files on watched directories, up until now..

I'm trying to run a command 'bwavinfo' via a simple .bat file. For the command to work, it requires an "--info" switch after the bwavinfo command, and before the input/output filenames (i.e. bwavinfo --info in.wav >in.txt). I have a working batch file which will do this outside of watchdirectory using the above script, though when i try and run it via watchdirectory, i'm met with a 'bwavinfo is not reconized as an internal or external command' message.

Here's my WD batch file:

bwavinfo --info "%WD_FILE%" >"N:\%WD_FILE_B%.wav.txt"

bwavinfo relies on Ruby and Java to run, but has been installed correctly, and works fine via a command prompt. Where am I going wrong?!

Adam.

A

Adam,

bwavinfo --info "%WD_FILE%" >"N:\%WD_FILE_B%.wav.txt"

May I suggest to you to always use full path-names in batch scripts. Something like this:

"C:\Program Files\bwa\bwavinfo.exe" --info "%WD_FILE%" >"N:\%WD_FILE_B%.wav.txt"

That way, the bwainfo program can be found no matter how your PATH is setup.

Also, redirecting to "N:\...."... it looks like N: is a mapped network drive? Remember that these drive-mapping will not work if you run this WD task as a service. It is probably a better way to use the UNC name of the drive-mapping, something like

"C:\Program Files\bwa\bwavinfo.exe" --info "%WD_FILE%" >"\\Server\share\%WD_FILE_B%.wav.txt"

Finally, for the Ruby & Java issue, you also need to remember that the environment (among other things the PATH setting) may be different for Windows Services. You could temporarily change the PATH in your batch-script yourself, to work-around this, something like

 
SET PATH=C:\Program Files\Java\jre1.6.0\bin;%PATH%
SET PATH=C:\Program Files\RoR\Bin;%PATH%
"C:\Program Files\bwa\bwavinfo.exe" --info "%WD_FILE%" >"\\Server\share\%WD_FILE_B%.wav.txt" 

Further reading

All those WD_ variables you can use in your batch files...

No comments: