0

Below hrcmd.cmd file

echo off

for /F %%a in ("%~fs0") do set THIS_DIR=%%~dpa

call %THIS_DIR%FRSetenv.cmd

set CLASSPATH=

set ANT_HOME=

set ANT_HOME=%HYPERION_ANT%

set JAVA_HOME=

set JAVA_HOME=%HYPERION_JRE%

set PATH_ORIG=%PATH%

set PATH=

set PATH=%FR_HOME%\bin;%JAVA_HOME%\BIN;%ANT_HOME%\bin;%PATH_ORIG%

if not exist "%FR_HOME%\temp" mkdir "%FR_HOME%\temp"

set ANT_OPTS=-Djava.io.tmpdir="%FR_HOME%\temp" -Xms128m -Xmx256m

Below Batchadmin.xml file

echo on

Allows running of batches and encoding passwords.

<!-- set global properties for this build -->

resultproperty="batch.return">

path="${home.hyperion}/products/financialreporting/lib/FRBaseCP.jar"/>

Djava.util.logging.config.class=oracle.core.ojdl.logging.LoggingConfiguration" />

Doracle.core.ojdl.logging.config.file=${home.hyperion}/products/financialreporting/bin/Batc

hAdminlogging.xml" />

${env.PASSWORD}" />

${env.BATCH_INPUT_FILENAME}">

${env.BATCH_INPUT_FILENAME} - See logs for details">

${env.BATCH_INPUT_FILENAME} - See logs for details">

<target name="batch.encodepassword">

path="${home.hyperion}/products/financialreporting/lib/FRBaseCP.jar"/>

script below

@ECHO OFF

set userid=xxx

set pwd=xxx

SET "xml_dir=c:\Today\set"

SET "hyp_server=10.11.12.13"

For %%z in ("%xml_dir%*.xml") do (

call scheduleBatch "%%z" %userid% %pwd% %hyp_server%

echo %errorlevel%

if %errorlevel% == 1 >>"C:\Today\xml-error.log" echo "%%z" failed

if not %errorlevel% == 1 >>"C:\Today\xml-pass.log" echo "%%z" succeeded

)

I need to create a generic batch script to launch the batch xml files from a 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 xml files when we run script. Below batch script I have written a genric script(which launch a set of batch .xml files from any folder and scheduling it through windows task scheduler at a predefined time to run particular folder).

REM Use this to schedule a Financial Reporting Batch from a command line
REM Specify four arguments when calling this command file:
REM The first is the fully qualified name of the batch input xml file for the batch to be scheduled such as c:\\temp\\mybatch.xml
REM The second is the Reports Web Server URL with correct protocol and port such as http:/XXX
REM The third is a valid username for the batch routine
REM The fourth is the password
SETLOCAL
if "%~1" == "" goto Usage
if "%~2" == "" goto Usage
if "%~3" == "" goto Usage
if "%~4" == "" goto Usage
if not exist "%~1" goto NotExist
SET BATCH_INPUT_FILENAME=%~fs1
SET WEB_SERVER=%2
SET USERNAME=%3
SET PASSWORD=%4
for /F %%a in ("%~fs0") do set THIS_DIR=%%~dpa
call %THIS_DIR%hrcmd.cmd
ant -q -f "%FR_HOME%\bin\BatchAdmin.xml" batch.schedule
goto End
:Usage
ECHO Usage: BatchInputFilename FRWebServerURL Username Password
goto End
:NotExist
ECHO File "%~1" not found
:End
ENDLOCAL

2 @ECHO OFF

set "userid=joe"

set "pwd=jack"

SET "xml_dir=c:\Today\set"

SET "FILE=%MAINLOG%"

SET "hyp_server=10.11.12.13"

For %%z in ("%xml_dir%*.xml") do (

call scheduleBatch "%%z" %userid% %pwd% %hyp_server%

findstr /R "\ ErrCheck

for /F %%A in ("ErrCheck") do If %%~zA NEQ 0 (

echo Error in Batch scheduling Process......................... >> %MAINLOG%

copy %MAINLOG% %LOG_DIR%\%MAINLOG%-Error.log

DEL /Q ErrCheck )

else (

echo Batch scheduling Process was successfull......................... >> %MAINLOG%

copy %MAINLOG% %LOG_DIR%\%MAINLOG%-Pass.log

)

)

4

1 回答 1

1

这将使用目录中的每个 *.xml 文件和您的额外设置调用 schedulebatch.cmd。日志文件取决于您的 schedulebatch.cmd 返回适当的错误级别。

@ECHO OFF
set userid=joe
set pwd=jackson
SET "xml_dir=c:\today\set"
SET "hyp_server=10.11.12.13"
For %%z in ("%xml_dir%\*.xml") do (
call schedulebatch "%%z" %userid% %pwd% %hyp_server%
if errorlevel 1    >>"C:\Today\xml-error.log" echo "%%z" failed
if not errorlevel 1 >>"C:\Today\xml-pass.log" echo "%%z" succeeded
)
于 2013-06-21T05:52:15.553 回答