Solved

Backup batch file

Posted on 2011-02-21
9
736 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
 
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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

cPanel is a Unix based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilizes a 3 tier structure that provides functionality for administrators, rese…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now