hrcmd.cmd文件
回声
for / F %% a in(“%~fs0”)确实设置THIS_DIR = %% ~dpa
调用%THIS_DIR%FRSetenv.cmd
设置CLASSPATH =
设置ANT_HOME =
设置ANT_HOME =%HYPERION_ANT%
设置JAVA_HOME =
设置JAVA_HOME =%HYPERION_JRE%
设置PATH_ORIG =%PATH%
设置PATH =
设置PATH =%FR_HOME%\ bin;%JAVA_HOME%\ BIN;%ANT_HOME%\ bin;%PATH_ORIG%
如果不存在“%FR_HOME%\ temp”mkdir“%FR_HOME%\ temp”
设置ANT_OPTS = -Djava.io.tmpdir =“%FR_HOME%\ temp”-Xms128m -Xmx256m
Batchadmin.xml文件
回显
允许运行批次和编码密码。
<!-- set global properties for this build -->
resultproperty = “batch.return” &GT;
路径= “$ {home.hyperion} /products/financialreporting/lib/FRBaseCP.jar”/&GT;
Djava.util.logging.config.class = oracle.core.ojdl.logging.LoggingConfiguration“/&gt;
Doracle.core.ojdl.logging.config.file = $ {home.hyperion} /产品/ financialreporting / bin中/ BATC
hAdminlogging.xml“/&gt;
$ {env.PASSWORD}“/&gt;
$ {env.BATCH_INPUT_FILENAME}“&GT;
$ {env.BATCH_INPUT_FILENAME} - 有关详细信息,请参阅日志“&gt;
$ {env.BATCH_INPUT_FILENAME} - 有关详细信息,请参阅日志“&gt;
<target name="batch.encodepassword">
路径= “$ {home.hyperion} /products/financialreporting/lib/FRBaseCP.jar”/&GT;
下面的脚本
@ECHO OFF
设置userid = xxx
设置pwd = xxx
SET“xml_dir = c:\ Today \ set”
SET“hyp_server = 10.11.12.13”
对于%% z in(“%xml_dir%*。xml”)do(
call scheduleBatch“%% z”%userid %% pwd %% hyp_server%
echo%errorlevel%
如果%errorlevel%== 1&gt;&gt;“C:\ Today \ xml-error.log”echo“%% z”失败
如果不是%errorlevel%== 1&gt;&gt;“C:\ Today \ xml-pass.log”echo“%% z”成功
)
我需要创建一个通用批处理脚本来从文件夹启动批处理xml文件,并在预定义的时间通过Windows任务sheduler进行调度。 这些批处理xml文件来自财务报告工作室,scheduleBatch.cmd是内置实用程序,它在我们运行脚本时调用这些xml文件。在批处理脚本下面,我编写了一个genric脚本(从任何文件夹启动一组批处理.xml文件,并在预定义的时间通过Windows任务调度程序安排它来运行特定文件夹)。
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
设置“userid = joe”
设置“pwd = jack”
SET“xml_dir = c:\ Today \ set”
SET“FILE =%MAINLOG%”
SET“hyp_server = 10.11.12.13”
对于%% 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(
批量调度过程中的回声错误.........................&gt;&gt; %MAINLOG%
复制%MAINLOG %% LOG_DIR%\%MAINLOG%-Error.log
DEL / Q ErrCheck )
其他(
echo批量调度过程成功.........................&gt;&gt; %MAINLOG%
复制%MAINLOG %% LOG_DIR%\%MAINLOG%-Pass.log
)
)
答案 0 :(得分:1)
这将调度schedulebatch.cmd与目录中的每个* .xml文件以及您的额外设置。日志文件取决于您的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
)