Solved

Backup batch file

Posted on 2011-02-21
9
742 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Disclosure: Use this tutorial only when no other options helps to get Windows XP running without any problems and you don't want to format the drive. The back up of the data is the responsible of the user, however there is a description of how t…
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…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

615 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