找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 15893|回复: 1

[特效代码] bat调用kettle脚本

[复制链接]
发表于 2022-7-7 20:07:39 | 显示全部楼层 |阅读模式
  1. @echo off
  2. REM 开始设置批处理窗口
  3. mode con cols=80 lines=30 & color 0a
  4. title 航发风险管理系统批处理运行程序
  5. set teststring=%1

  6. for /f "skip=3 tokens=4" %%i in ('sc query OracleServiceORCL') do set "zt=%%i" &goto :next
  7. :next
  8. if /i "%zt%"=="RUNNING" (
  9.     echo 生产环境10.10.14.24服务器上oracle数据库服务正在运行,可以正常跑批。

  10. ) else (
  11.     echo 生产环境10.10.14.24服务器上oracle数据库服务处于停止状态。
  12.     echo 准备启动oracle数据库服务。。。
  13.     net start "OracleOraDB11g_Home1TNSListener"
  14.     net start "OracleServiceORCL"
  15.     echo 生产环境10.10.14.24服务器上oracle数据库服务启动成功。
  16. )

  17. echo %teststring%

  18. setlocal ENABLEDELAYEDEXPANSION

  19. REM 批处理中字符串分割实现循环输出

  20. REM 循环遍历并截取
  21. :stringLOOP
  22.     REM 当批处理字符串为空什么也不做
  23.     if "!teststring!" EQU "" goto END

  24.     for /f "delims=_" %%a in ("!teststring!") do set substring=%%a

  25.         REM Do something with the substring -
  26.         REM we just echo it for the purposes of demo
  27.      echo !substring!






  28. ###############我想在这里去写一些逻辑,根据for循环遍历的变量值判断是否等于某个字符串,现在一直提示命令不正确。。。。麻烦大佬帮忙看一下####################
  29.       if !substring! equ "thes"
  30.            (echo 11111111)
  31.            else
  32.            (echo 222222)
  33. ###########################################################################################################
  34.        

  35. REM Now strip off the leading substring
  36. :striploop
  37.     set stripchar=!teststring:~0,1!
  38.     set teststring=!teststring:~1!
  39.     if "!teststring!" EQU "" goto stringloop
  40.     if "!stripchar!" NEQ "_" goto striploop
  41.     goto stringloop
  42. )

  43. :END
  44. endlocal
  45. pause>nul




复制代码
发表于 2022-7-7 21:04:29 | 显示全部楼层
回复 1# yangluabab
  1. if "!substring!" equ "thes" (
  2.     echo 11111111
  3. ) else (
  4.     echo 222222
  5. )
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-19 19:41 , Processed in 0.015786 second(s), 7 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表