Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

enhance batch files

Posted on 2012-04-10
5
Medium Priority
?
387 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 59

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 71

Accepted Solution

by:
Qlemo earned 2000 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 59

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
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…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

783 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