i have a batch file that gets hung after searching a text file for a string. I run a psql query, output to txt file, and then search for string "(0 rows)" in the txt file. Somewhere between that 'findstr' statement and my 'if %errorlevel%' statement, my batch file fails with the error "\Business was unexpected at this time". i cannot figure out why. I even googled the phrase and got nothing. Anyone have an idea how to make this go away?
When i turn off '@echo off' and run bat from cmd, i see the error inbetween findsrt and if statments. However in the output it shows cd as the next statment, which in my code it definately isnt.
Code:
-blah
-blah
psql ------options and statement
findstr /C:"(0 rows)" "%clinic%"results2.txt > NUL 2>&1
if %errorlevel%==1 (
-blah
-blah
Code:
D:\Program Files (x86)\PostgreSQL\9.1\bin>findstr /C:"(0 rows)" results2.txt 1>NUL 2>&1
\Business was unexpected at this time.
D:\Program Files (x86)\PostgreSQL\9.1\bin>cd c:\Program Files (x86)\Business Objects\Common\3.5\bin\NOTES\;c:\Program Files (x86)\Business Objects\Common\3.5\bin\NOTES\DATA\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;d:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;d:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;d:\Program Files\Microsoft SQL Server\100\Tools\Binn\;d:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\
D:\Program Files (x86)\PostgreSQL\9.1\bin>