1.

Solve : Using AND condition in DOS script causes trouble.?

Answer»

In a batch file I have

findstr SWITCHIDENTITY rf_monitor.out >nul 2>&1 && SET IDENTITY_FOUND=true
findstr SWITCHUTILITY rf_monitor.out >nul 2>&1 && set UTILITY_FOUND=true
findstr "GP Manager connection successful" rf_monitor.out >nul 2>&1 && set GPMANAGER_FOUND=true

With echo on, below is what I see

D:\cvstags\trunk\regfortcms\install\win\scripts>findstr SWITCHIDENTITY rf_monito
r.out 1>nul 2>&1 && set IDENTITY_FOUND=true

D:\cvstags\trunk\regfortcms\install\win\scripts>findstr SWITCHUTILITY rf_monitor
.out 1>nul 2>&1 && set UTILITY_FOUND=true

D:\cvstags\trunk\regfortcms\install\win\scripts>findstr "GP Manager connection s
uccessful" rf_monitor.out 1>nul 2>&1 && set GPMANAGER_FOUND=true
**&& was unexpected at this time.**

Why do I get that && was unexpected at this time? If I type the three commands myself on the DOS prompt I don't get any such message. Please advice.
--------, the error message had been not about the lines I posted but about my usage of && in an IF condition. It seems that I have to use like IF condition1 IF condition2 .


Keep it clean...we have Members of all AGES here.you could always use the XIF utillity i created but and is just IF A IF B



Discussion

No Comment Found