Solved

enhance batch files

Posted on 2012-04-10
5
312 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
5 Comments
 
LVL 51

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 68

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 51

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Learn about cloud computing and its benefits for small business owners.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

9 Experts available now in Live!

Get 1:1 Help Now