|
I need to create a generic batch script to launch the batch files from any folders and scheduling through windows task sheduler at predefined time.These batch xml files are from financial reporting studio and scheduleBatch.cmd is the inbuilt utility which
calls these files(xmlfiles) when we run script. Below 1st batch script I have written for genric script(which launch a set of batch .xmlfilesfrom any folder and scheduling it through windows task scheduler at a predefined time to run particular folder) and
2nd batch script which launches the batch xml files pointing to only Monthly daily weekly folder My 1st scipts is not working properly as expected. Am I missing something! please help me out on what lines to be added to make as expected. For the 1st script Let say there are n number of batch xml files that needs to be executed by the bat script and shedule these xml by windows task scheduler(daily monthly weekly) .How do i go about designing a script that will do the following:1. executing a list of n nuber of files to run from that folder. 2. Do I need to pass any kind of parameters or set up any variables 3. If the execution is successful the next file in the order is executed automatically and so on and goes to script\success.log file .If it is failed it should goes to script\Failed.log file how the error handling can be done to this script Do i put the above inside a function and pass the files as arguments or do i go with loops. Please help me out , i'd be extremely grateful. Thanks in advance 1) SET xml_dir=%1 SET hyp_server="server name" For %%z in (%xml_dir%\*.xml) do schedulebatch %%z %hyp_server% 2) @echo off SET SCRIPTLOG=\Batch.log echo Frequency can be entered as Daily, Weekly and Monthly set /p frq="Enter Frequency: " %=% IF %frq% ==Daily ( echo Frequency is Daily > %SCRIPTLOG% setlocal for /l %%x in (1, 1, 1) do ( SET BATCHNUM=0%%x call schedulebatch.bat !BATCHNUM:~-2!.xml if !ERRORLEVEL! GEQ 1 ( echo Error scheduling FR_Daily_!BATCHNUM:~-2!.xml ......................... >> %SCRIPTLOG% copy %SCRIPTLOG% <your error directory>\%~n0_%TODAY%.log echo FR_Daily_!BATCHNUM:~-2!.xml scheduling was successful. >> %SCRIPTLOG% ) ) setlocal DISABLEDELAYEDEXPANSION ) else ( IF %frq% ==Weekly ( echo Frequency is Weekly > %SCRIPTLOG% setlocal ENABLEDELAYEDEXPANSION for /l %%x in (1, 1, 1) do ( SET BATCHNUM=0%%x call schedulebatch.bat !BATCHNUM:~-2!.xml if !ERRORLEVEL! GEQ 1 ( echo Error scheduling FR_Weekly_!BATCHNUM:~-2!.xml ......................... >> %SCRIPTLOG% copy %SCRIPTLOG% <your error directory>\%~n0_%TODAY%.log echo FR_Weekly_!BATCHNUM:~-2!.xml scheduling was successful. >> %SCRIPTLOG% ) ) setlocal DISABLEDELAYEDEXPANSION ) else ( IF %frq% ==Monthly ( echo Frequency is Monthly > %SCRIPTLOG% setlocal ENABLEDELAYEDEXPANSION for /l %%x in (1, 1, 1) do ( SET BATCHNUM=0%%x call schedulebatch.bat !BATCHNUM:~-2!.xml if !ERRORLEVEL! GEQ 1 ( echo Error scheduling FR_Monthly_!BATCHNUM:~-2!.xml ......................... >> %SCRIPTLOG% copy %SCRIPTLOG% <your error directory>\%~n0_%TODAY%.log echo FR_Monthly_!BATCHNUM:~-2!.xml scheduling was successful. >> %SCRIPTLOG% ) ) setlocal DISABLEDELAYEDEXPANSION ) else ( echo Entered frequency does not match with the Batch Frequency ) ) ) |
↧
Batch script to launch the xml files from set of folder
↧