Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Backup batch file

Posted on 2011-02-21
9
Medium Priority
?
748 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
  • 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
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!

 
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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Integration Management Part 2
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…
Suggested Courses

927 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