Solved

enhance batch files

Posted on 2012-04-10
5
370 Views
Last Modified: 2012-05-08
Dear persons,

Looking to add enhancements to a specific client-run batch file.  The batch file drives a special backup solution, and mobile workers are required to perform a manual backup with some regularity.  The job consists of a third-party backup solution but is activated by a batch file.

I am hoping to add features into the batch file, eitehr via scriptig or possibly via  a third-party (affordable for sure) that will include such enhancements as:  Emailing when the job completes successfully; logging how many times the batch is run, and perhaps a couple of more features.
0
Comment
Question by:SRC-S1
[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 Comments
 
LVL 56

Expert Comment

by:Bill Prew
ID: 37830892
For emailing from a BAT file check out BLAT, it's a common free tool that can provide that capability.

http://www.blat.net/

For other enhancements if you can share more specifics, and/or your current script we can then provide some detailed solutions.

~bp
0
 
LVL 7

Expert Comment

by:mayureshtodankar
ID: 37830924
Please share the script, so we enchance it more with logging and emailing options.
0
 
LVL 1

Author Comment

by:SRC-S1
ID: 37831075
My script file is as follows:

echo off
cls
c:\BUSpec\BUSPec.exe c: \\main-server\Workstations\%computername%-%date%.BUS
cls
exit


Basically this script loads the DOS-based backup utility and runs it, saving the backup job into the server's workstations backup folder, and including the computer name and date in the file name.

For some sites, we run this through the built-in Windows Task Scheduler, and it will run accoridng to that schedule.  For manual deployments it is up to the user.

Either way, there is no way to track when it runs, neitehr whether the job was successful or not.  I can only gues that there are likely some third-party, and free or low-cost, solutions that will work together with windows-based batch files top include enhancemenbts such as emailing (though Blat may work as provided by BillPrew) and hopefully a logging or flagging of when and how many times the manual batch is run.
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 37832548
Determining success would get difficult. You can't just check for existence of the BUS file, as the backup might be partially successful - having not backed up some important data.
Logging when a backup is (tried to) run is no issue; just create a log file and write date and time into it. If you put it onto the server, you have easy access, but any issue in regard of not being able to access the server would stay unnoted. So maybe a two-step logging is a good idea:
@echo off
echo off
cls
>> c:\BUSPec\%computername%.log 2>&1 (
  @echo ---- %date% %time% -------
  c:\BUSpec\BUSPec.exe c: \\main-server\Workstations\%computername%-%date%.BUS
)
copy \\main-server\Workstations\BUS-%computername%.log+c:\BUSPec\%computername%.log >nul 2>nul && del c:\BUSPec\%computername%.log
exit /b

Open in new window

That way you should be able to spot generic errors. I don't know whether BUSPec.exe will output any useful information, but if, it is logged.
The script can then take the output, search for some keywords like "SUCCESS", and determine whether it has been ok or not. But to help further we would need to see example logs for success and failure.
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 37845453
@SRC-S1

Is there any documentation for the BUSpec backup utility you are using that you could point me to online?  I'd like to see what capabilities it has for error returns and logging.

~bp
0

Featured Post

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

Question has a verified solution.

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

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
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 are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

630 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