
bat調用kettle腳本
nclick="copycode($('code0'));">復制代碼
- @echo off
- REM 開始設置批處理窗口
- mode con cols=80 lines=30 & color 0a
- title 航發風險管理系統批處理運行程序
- set teststring=%1
- for /f skip=3 tokens=4 %%i in ('sc query OracleServiceORCL') do set zt=%%i &goto :next
- :next
- if /i %zt%==RUNNING (
- echo 生產環境10.10.14.24服務器上oracle數據庫服務正在運行,可以正常跑批。
- ) else (
- echo 生產環境10.10.14.24服務器上oracle數據庫服務處于停止狀態。
- echo 準備啟動oracle數據庫服務。。。
- net start OracleOraDB11g_Home1TNSListener
- net start OracleServiceORCL
- echo 生產環境10.10.14.24服務器上oracle數據庫服務啟動成功。
- )
- echo %teststring%
- setlocal ENABLEDELAYEDEXPANSION
- REM 批處理中字符串分割實現循環輸出
- REM 循環遍歷并截取
- :stringLOOP
- REM 當批處理字符串為空什么也不做
- if !teststring! EQU goto END
- for /f delims=_ %%a in (!teststring!) do set substring=%%a
- REM Do something with the substring -
- REM we just echo it for the purposes of demo
- echo !substring!
- ###############我想在這里去寫一些邏輯,根據for循環遍歷的變量值判斷是否等于某個字符串,現在一直提示命令不正確。。。。麻煩大佬幫忙看一下####################
- if !substring! equ thes
- (echo 11111111)
- else
- (echo 222222)
- ###########################################################################################################
- REM Now strip off the leading substring
- :striploop
- set stripchar=!teststring:~0,1!
- set teststring=!teststring:~1!
- if !teststring! EQU goto stringloop
- if !stripchar! NEQ _ goto striploop
- goto stringloop
- )
- :END
- endlocal
- pause>nul

