Solved

Backup batch file

Posted on 2011-02-21
9
741 Views
Last Modified: 2012-06-27
This should be pretty easy but the combinations i've tried don't cut it. I want to


a. start a backup app using apache Ant with Start|Run|Backup
b. Have the backup run and print a message telling the user to close the window afterwards

I tried the following, but the window didn't remain
:: Run a backup
ant -f backup.xml backup
echo You can close this window now
pause

Open in new window

0
Comment
Question by:CEHJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 34946501
How are  you firing off the batch job?  From the Task Scheduler, or from double-clicking an icon, or what?  If from the Task Scheduler, is "Run only if logged on" checked?
0
 
LVL 86

Author Comment

by:CEHJ
ID: 34946576
>>How are  you firing off the batch job?

>>start a backup app using apache Ant with Start|Run|Backup
0
 
LVL 16

Expert Comment

by:sjklein42
ID: 34946675
If I understand your original problem, it is that the "pause" statement is not actually pausing.  Is this right?

I also think there was a small confusion about my previous question.  The four lines of code you posted above - are they in a batch file?  Like a file called "runbackup.bat"?  That's the batch job I was asking about.  If so, how are you starting it?  From the command line, double-click an icon, or what?

As an experiment, if you temporarily get rid of the ANT line, does the batch job pause the way you want it to?  Of course it will not have done the backup, but does the pause work?

:: Run a backup
echo You can close this window now
pause 

Open in new window

0
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
LVL 86

Author Comment

by:CEHJ
ID: 34947107
>> The four lines of code you posted above - are they in a batch file?  Like a file called "runbackup.bat"?  

Yes

>> If so, how are you starting it?  From the command line, double-click an icon, or what?

>> with Start|Run|Backup

>> but does the pause work?

Can't test now, but, afaicr, no
0
 
LVL 16

Expert Comment

by:sjklein42
ID: 34947345
Works for me (but isn't that always the way).  Gotta be something simple we're missing.

First of all, make sure that "pause" works for you from a DOS command window.

If that works, then make a new batch file "pauseme.bat" (don't call it "pause.bat") with just the "pause" command. Does pauseme.bat properly pause when you run it from Start/Run (pauseme)?  If not, what does it do when you run it in a DOS command window?

As an aside, using "::" for a comment (is that what you're doing?) is not advisable.  I think you should be using REM.

pauseme.bat:
REM Run a backup
echo You can close this window now
pause

Open in new window


0
 
LVL 86

Author Comment

by:CEHJ
ID: 34950813
I don't know why but the pause thing has something to do with the way Ant runs. As soon as the ant command is added into the mix, then pause has no effect and the window disappears when the ant has finished. Possibly something to do with the fact that ant itself starts with a batch file.

The workaround is to use the Ant <input> element
0
 
LVL 86

Author Comment

by:CEHJ
ID: 34951045
If you can look into my theory (and you feel like doing so) i will gladly award maximum points for what could be a useful addition to the EE database
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 250 total points
ID: 34952628
Hello.

ANT is, in fact, a batch file, so you need to "call" it or it doesn't return.

REM Run a backup
call ant -f backup.xml backup
echo You can close this window now
pause

Open in new window

0
 
LVL 86

Author Closing Comment

by:CEHJ
ID: 35082001
Good - just the confirmation i needed :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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!    …
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

734 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