1.

Solve : Running Program w/ Batch File?

Answer»

I am trying to run a program via a batch file. Problem is that is resides on another directory (ie. Z:\). How do I change the directory before I run the command to launch the program?

Here is my batch file:

@ ECHO OFF

REM Set the DATE that this occured
Date /t >pbvalert.log

REM Set the time that this occured
time /t >pbvalert.log

REM Set the directory to Z:\
Z:

REM run the Alert for missing data
"pbvcon.exe RUN_ALERT MGBALSCARD-DB "2005 Database" thorne cole55 "Alert"

pauseI made a few changes (the time in the log would have writen over the date)

Code: [Select]
@ ECHO OFF

REM Set the date that this occured
Date /t >pbvalert.log

REM Set the time that this occured
time /t >>pbvalert.log

REM Set the drive to Z
Z:
REM Set the directory to \
cd \

REM run the Alert for missing data
"pbvcon.exe RUN_ALERT MGBALSCARD-DB "2005 Database" thorne cole55 "Alert"

pause


Depending what you are doing, you may want to use a call in front of "pbvcon"

Hope this helps. I ran you're changes and it still seems as if its looking for the "pbvcon.exe" file to be located on C:\Documents and Setting\user\desktop\REM.

Any other ideas? Again THANKS for you're help.What message did you get indicating it was searching C:\Documents and Setting\user\desktop\REM?

When I tried the code, I got an error message: '"pbvcon.exe RUN_ALERT MGBALSCARD-DB "2005' is not recognized as an internal or external command, operable program or batch file.

It may have SOMETHING to do with the quotes:

Code: [Select]
@echo off
date /t > log
time /t >> log
z:
cd \
pbvcon.exe RUN_ALERT MGBALSCARD-DB "2005 Database" thorne cole55 "Alert"


From what I can see, you have 6 parameters being sent to the program. If this is not the case, use quotes around the parameters only and they must be balanced (a starting quote must have a ending quote)

Good luck.



Discussion

No Comment Found