[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Program not running from a batch file

Posted on 2005-04-14
4
Medium Priority
?
724 Views
Last Modified: 2012-08-13
Hello,

I have a batch file that calls a program to do a database backup. If I run it from the command line, it will run fine, but it will not run from my batch file. The code being used is the following:


SET BATLOGFILE=D:\CTSQL\BACKUPS\CT.log

rem Get the day, month and year
for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (set weekday=%%a& set tmonth=%%b& set tday=%%c& set tyear=%%d)
IF "%BATLOGFILE%" == "" SET BATLOGFILE= D:\CAFETERMSQL\BACKUPS\CAFETERM.LOG
echo ------------------------------------------------- >> %BATLOGFILE%
echo OPEN >> %BATLOGFILE%
echo C:\PROGRA~1\FIREBIRD\FIREBIRD_1_5\BIN >> %BATLOGFILE%
echo D:\CAFETERMSQL\BACKUPS >> %BATLOGFILE%
Date /T >> %BATLOGFILE%
Time /T >> %BATLOGFILE%


rem ========= Step 4: backup database =========
echo backup Database... >> %BATLOGFILE%

C:\"Program Files"\FIREBIRD\FIREBIRD_1_5\BIN\gbak -B -user USERID -password USERPASS    localhost:D:\CT\CT033105.FDB D:\CT\BACKUPS\CT.bck 2> errout.tmp
echo 1> nul 2> empty.tmp
echo N 1> N_CR.tmp
comp errout.tmp empty.tmp 1> nul 2> nul < N_CR.tmp
if errorlevel 1 GOTO NOT_BACKEDUP
echo backup CT.FDB ok >> %BATLOGFILE%
...

the gbak is not being executed. I am having the same problem in another machine, but the strange thing is that it was running correctly in that machine until one day when it would not run.
Thank you
0
Comment
Question by:hcarvajal
  • 2
4 Comments
 
LVL 5

Expert Comment

by:yronnen
ID: 13782982
Just a wild guess, but maybe you should try executing the backup app like this:

start /wait "C:\Program Files\FIREBIRD\FIREBIRD_1_5\BIN\gbak" -B -user USERID -password USERPASS    localhost:D:\CT\CT033105.FDB D:\CT\BACKUPS\CT.bck 2> errout.tmp
0
 

Author Comment

by:hcarvajal
ID: 13783048
No, it did not worked. In the log file I get the messages:

backup Database...
backup CT.FDB ok

but there is no backup file.
thanks.
0
 

Accepted Solution

by:
Andrep23 earned 1500 total points
ID: 13815515
What is, when you make this first:

cd C:\"Program Files"\FIREBIRD\FIREBIRD_1_5\BIN\

and then:

gbak -B -user USERID -password USERPASS    localhost:D:\CT\CT033105.FDB D:\CT\BACKUPS\CT.bck 2> errout.tmp
0
 

Author Comment

by:hcarvajal
ID: 13815921
before the cd C:\"Program Files"\FIREBIRD\FIREBIRD_1_5\BIN\  I had to add
c:
and it worked.
thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ok I have been working on this for some time having learned and gained certification in XenDesktop 4 along came version 5 which was released last month. Since then I have been working to deploy XenDesktop 5 in a small environment with only 2 virt…
It is only natural that we all want our PCs to be in good working order, improved system performance, so that is exactly how programs are advertised to entice. They say things like:            •      PC crashes? Get registry cleaner to repair it!    …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question