Jump to content
Sign in to follow this  
SummerGirl

Run muliple batch file logging the time taken & status to txt file

Recommended Posts

Dear all,

        I am new to Auto I and I need all your kind suggestons & help.

I have received many batch files and they need to be executed sequentially.

Each batch files takes a lot of time and I want to use Auto It to run them sequentially

logging the time taken and status of each batch file to txt file.

Now I am able to run one batch file and pop time taken. But want to change.
Please help me.

My batch files:

Test1.bat~Test20.bat (20 files)

My present code:

$StartTime=TimerInit()

RunWait("C:TestFileTest1.bat")

$EndTime=TimerDiff($StartTme)

Msgbox(0,"Time ","Time taken to run batch 1 is:"&$EndTime)

Kindly note each batch file exits after a key is clicked.

Can any body help how to run them sequentially and log the time and status of batch file completed (Success/error)

Thanking you in advance.

Share this post


Link to post
Share on other sites

I was gonna sugest that, also, remove the pause from the end of the batch.

This is how i would do it:

For $i = 1 to 20
$StartTime=TimerInit()
RunWait("C:\TestFile\Test"&$i&".bat")
$EndTime=TimerDiff($StartTme)
Msgbox(0,"Time ","Time taken to run batch "&$i&" was:"&$EndTime)
Next

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

To log the "status" you need this enhanced version:

For $i = 1 to 20
    $StartTime=TimerInit()
    $iReturnValue = RunWait("C:\TestFile\Test" & $i & ".bat")
    $EndTime = TimerDiff($StartTme)
    Msgbox(0,"Time ","Time taken to run batch " & $i & " was: " & $EndTime & ", Status returned: " & $iReturnValue)
Next

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Replace MsgBox with FileWriteLine.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Glad to be o service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-08-19 - Version 1.4.13.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-07-24 - Version 1.3.6.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (NEW 2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Taks Scheduler (NEW 2019-10-09 - Version 0.9.0.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...