enhance batch files

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.
LVL 1
SRC-S1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
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
mayureshtodankarCommented:
Please share the script, so we enchance it more with logging and emailing options.
SRC-S1Author Commented:
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.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
@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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.