WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Run specific .vbs file via .bat
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1110610089

Message started by zr11 on Mar 12th, 2005 at 7:48am

Title: Run specific .vbs file via .bat
Post by zr11 on Mar 12th, 2005 at 7:48am
I am looking for a solution using your program where the bat file that gets called is able to run a specific .vbs file based on the name of the file that has been created in the watched folder. What I mean in this:

1. Your program watches Folder C:\FOLDER

2. file NEWFILE.JPG is created in C:\FOLDER

3. Your pogram calls the bat DOIT.BAT and tells it the name of the new file created.

4. DOIT.BAT loads the executes the files NEWFILE.VBS based on the name of the created file.

For example if instead of NEWFILE.JPG that was created, it is say DOSOMETHINGELSE.JPG the the .vbs file that the bat would execute in the end would be DOSOMETHINGELSE.VBS

Is this possible with your software package and if so what would the bat for something like that look like??

Thanks,
Mark

Title: Re: Run specific .vbs file via .bat
Post by Gert on Mar 12th, 2005 at 9:15am
Hello Mark,

Yes, that should be possible... The DOIT.BAT would look something like this:
[code]
@echo off

rem where are the .vbs files located (no trailling backslash)
SET VBSLOC=C:\VBSFILES

rem only process new files
IF "%WD_REASON%" NEQ "FILENEW" GOTO :Eof

rem the .vbs to call depends on the filename created
rem  WD_FILE_N contains the filename without path or extension
SET VBSTOCALL=%VBSLOC%\%WD_FILE_N%.VBS

rem check if the VBS exists
IF NOT EXIST "%VBSTOCALL%" GOTO :NoVbs

"%VBSTOCALL%"

GOTO :Eof


:NoVbs
rem perhaps call a default VBS file here?

[/code]

Hope this helps,
Gert

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.