Jump to content

Batch file help

- - - - -

  • Please log in to reply
No replies to this topic

#1
warensemble

warensemble

    Newbie

  • Members
  • Pip
  • 1 posts
Was not sure where to post this but my issue is that for some reason I am unable to get the "find" command to set an errorlevel of 1 when it is supposed to in my for loop...not sure what to do here, been googling around and trying things for quite a while now...

code:


@echo off
cd %~dp0
for /f "tokens=*" %%i in ('dir /b /a-d ^C:\filefolder\*^') do (
find /i "%%i" filelist.txt
if %errorlevel% NEQ 0 echo %%i >> filesNotInList.txt
)

also tried

find /i "%%i" filelist.txt
if "%errorlevel%"=="1" echo %%i >> filesNotInList.txt

and

find /i "%%i" filelist.txt
errorlevel=
if %errorlevel% NEQ 0 echo %%i >> filesNotInList.txt
..
The errorlevel ALWAYS returns 0 (of course I have several files not in the list in the "filefolder directory"

what gives?
Thanks for help!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users