如果不存在似乎没有工作 [英] if not exist doesn't seem to be working
问题描述
大家好,
我无法让它发挥作用,
for / F" tokens = 1 *" %% i in(%File_dbname%)do(
;                        &NBSP ;
                               
echo ***** ********
                   &NBSP
回波             %%甲DB每天检查ORA-ERROR在%% I> >%输出文件%
                   &NBSP
echo ******************************
                   &NBSP
echo。>>%output-file%
                   &NBSP
echo。>>%output-file%
                   &NBSP ;
REM                   &NBSP
if NOT exists alert _ %% A.log(
REM                   
echo alert _ %% A.log未找到>>%output-file%
                      &NBSP
REM              &NBSP ; &N BSP的;
)
  ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; < WBR>&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
::打印出所有ORA-错误及其相关时间戳
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP
findstr / br"Sun \> Mon\> Tue\> Wed\> Thu\> Fri\> Sat\> ORA- [0-9] *" alert _ %% A.log | findstr / r"!LF!ORA- ^ ORA-">>%output-file%
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
如果ERRORLEVEL 1回显NO ORA-在alert _ %% A.log>>%output-file%
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP
回波> ;>%output-file%
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP
回波> ;>%输出文件%
IF NOT EXIST alert _ %%。log echo no new alert _ %% A.log generated>>%output-file%
  ;
IF NOT EXIST alert_%%.log echo no new alert_%%A.log generated>> %output-file%
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;
)
基本上就是它循环遍历文件列表(这是动态的)如果找不到特定的文件,它会说还没有生成特定的日志。
basically is when it loop through the list of files (which is dynamically) and if that particular files is not found, it will says that particular log is not generated yet.
请帮助。
推荐答案
你想做什么?
为什么这个可怕的格式?它使代码几乎不可读?
最后一行中的字母"A"发生了什么变化?
IF NOT EXIST alert _ %%。log echo no new alert _ %% A.log generated>>%output-file%
IF NOT EXIST alert_ %% A .log echo no no alert _ %% A.log generated>>%output-file%
What are you trying to do?
Why this terrible formatting? It makes the code almost unreadable?
What's happened to the letter "A" in the last line?
IF NOT EXIST alert_%%.log echo no new alert_%%A.log generated>> %output-file%
IF NOT EXIST alert_%%A.log echo no new alert_%%A.log generated>> %output-file%
PS如果您想在日志文件中留空,请使用
echo。>> logfile
而不是¥b $ b echo。>> logfile
P.S. If you want a blank line in your log file, use
echo. >> logfile
instead of
echo .>> logfile
这篇关于如果不存在似乎没有工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!