Board logo

标题: 帮忙写个批处理,很简单的 [打印本页]

作者: chenmolin     时间: 2004-10-25 00:00    标题: 帮忙写个批处理,很简单的

有个文件test,通过命令看看test有没有 'ORA-' 'PLS-' 'EXP' 'OWS-' 等字符串,如果有其中任意一个,就执行以下的命令,net send ...
没有的话就安全退出,
请各位老大帮帮忙,不胜感激。
作者: chenall     时间: 2004-10-25 00:00
试试这个
for %i in ("ORA-" "PLS-" "EXP" "OWS-" do find %i test && net send ...... && exit
当前目录下要有TEST文件.如果没有则要指定全路径.

[此贴子已经被作者于2004-10-25 19:21:16编辑过]



作者: 龙王     时间: 2004-11-1 00:00
::findf
echo  @echo off >findf
echo type test|find "%1" >>findf.bat
echo if errorlevel 1 goto  _end >>findf.bat
echo if errorlevel 0 goto  _net >>findf.bat
echo  :_net >>findf.bat
echo net >>findf.bat
echo send >>findf.bat
echo goto _end >>findf.bat  
echo  :_end >>findf.bat
::findf  %1
for %f in (ORA-  PLS- EXP- OWS-) do findf %f  

[此贴子已经被作者于2004-11-2 9:39:17编辑过]



作者: 龙王     时间: 2004-11-2 00:00
实践是检验真理的唯一标准,楼主一个很简单的问题却让我测试了数次,虽然看似没有二楼的简单却也总算通过了,谁让我菜呢,幸亏不是闭卷考试。
作者: Denver     时间: 2005-2-1 00:00
@echo off



find 'ORA-' test ||  find 'EXP' test || find 'OWS-' test



echo keywords was not find



goto end



net send ...



:end

[此贴子已经被作者于2005-2-1 18:46:57编辑过]