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
How to pass the filename from .bat to .exe file (Read 2675 times)
lev
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
How to pass the filename from .bat to .exe file
Nov 2nd, 2004 at 10:08pm
 
Hi,
How can i pass the file_name from .bat file to an exe program?
I tried the following in a batch file:

@echo off

SET TARGETDIR=C:\temp2
IF NOT "%WD_RELDIR%" == "" SET TARGETDIR=%TARGETDIR%\%WD_RELDIR%
GOTO %WD_REASON%
:FILENEW
MOVE "%WD_FILE%" "%TARGETDIR%"
call c:\project1 %WD_FILE%

GOTO QUIT

But nothing happens.

Thanks for help
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: How to pass the filename from .bat to .exe fil
Reply #1 - Nov 2nd, 2004 at 10:38pm
 
Hello Lev,

Is your exe called c:\project1.exe ?
If you want to run an executable inside your .bat file you should not call it. "Call" is only used when you want to start other .bat files (or subroutines).

Also, the executable will probably need the filename as its first parameter. The way you wrote it, it will receive the filename in multiple parameters if the name has spaces in it. To prevent that, you should always enclose the name in "quotes":

Code:
c:\project1.exe "%WD_FILE%"
 



However, I see one additional problem:
You first move the file to a different directory.... Perhaps you should first start the project1.exe, and after that move the file?

Let me know if this helps, please.

Gert
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
 
lev
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Re: How to pass the filename from .bat to .exe fil
Reply #2 - Nov 4th, 2004 at 8:45pm
 
It solves the problem ,
Thanks a lot for help!
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1