Guest Posted May 21, 2013 Share Posted May 21, 2013 I'm looking to do the opposite of this....FOR %%i IN (WindowsXP-KB2756822-x86-ENU.exeWindowsXP-KB2761226-x86-ENU.exeWindowsXP-KB2761465-x86-ENU.exeWindowsXP-KB2778344-x86-ENU.exeWindowsXP-KB2779030-x86-ENU.exeWindowsXP-KB2792100-x86-ENU.exeWindowsXP-KB2797052-x86-ENU.exeWindowsXP-KB2799329-x86-ENU.exeWindowsXP-KB2799494-x86-ENU.exeWindowsXP-KB2808735-x86-ENU.exeWindowsXP-KB2809289-x86-ENU.exeWindowsXP-KB2817183-x86-ENU.exe) DO (IF EXIST %%i echo %%i exists)In other words, if there are some files that are not in the list, output something like echo %%i is and unknown file. Ask yourself why you need this.I suppose the only way to do this is with a dir /b>updates.txt or using OR's?Thanks! Link to comment Share on other sites More sharing options...
jaclaz Posted May 21, 2013 Share Posted May 21, 2013 What about forfiles? http://ss64.com/nt/forfiles.htmljaclaz Link to comment Share on other sites More sharing options...
Guest Posted May 21, 2013 Share Posted May 21, 2013 Thanks but it's for my UDC script and I can't redistribute MS binaries. I looked at the page and still don't see a way to do it with it. Link to comment Share on other sites More sharing options...
allen2 Posted May 21, 2013 Share Posted May 21, 2013 Why not use "findstr /V" as it will show everything except the pattern ? Link to comment Share on other sites More sharing options...
submix8c Posted May 21, 2013 Share Posted May 21, 2013 To be clear... The purpose is to notify/move any/all items NOT in your "standard download/build" list? I say that because I noted some IE7 Updates (among others) in your UDC script. You wish to "generically" eliminate any/all "OTHER" files? I noted a tendency of some users of your Script to "include" stuff that should NEVER have been there and then wondered "gee, why did it fail?"... (still ) Link to comment Share on other sites More sharing options...
gunsmokingman Posted May 21, 2013 Share Posted May 21, 2013 Are you trying to exclude certain updates from being installed? Link to comment Share on other sites More sharing options...
Guest Posted May 21, 2013 Share Posted May 21, 2013 To notify them that they are there and ask them to investigate further. I wont move them because of other add-ons they may add but way too many times they include crap updates. All they need are my updates. Link to comment Share on other sites More sharing options...
jumper Posted May 22, 2013 Share Posted May 22, 2013 (edited) I like recursive batch files: @echo offif %1*==* goto NOPARAM::Only list unapproved updatesif %1==WindowsXP-KB2756822-x86-ENU.exe goto ENDif %1==WindowsXP-KB2761226-x86-ENU.exe goto ENDecho %1goto END:NOPARAMecho Approved updates:if exist WindowsXP-KB2756822-x86-ENU.exe echo WindowsXP-KB2756822-x86-ENU.exeif exist WindowsXP-KB2761226-x86-ENU.exe echo WindowsXP-KB2761226-x86-ENU.exeecho.echo Unapproved updates:lfnfor onfor %%i in (WindowsXP-KB*.exe) do call %0 %%i:ENDUpdateAnother version that also lists missing files:@echo offset k1=KB2756822 KB2761226 KB2761465 KB2778344 KB2779030 KB2792100set k2=KB2797052 KB2799329 KB2799494 KB2808735 KB2809289 KB2817183if %1*==* goto NOPARAM::Only list unapproved updatesfor %%f in (%k1%) do if %1==WindowsXP-%%f-x86-ENU.exe goto ENDfor %%f in (%k2%) do if %1==WindowsXP-%%f-x86-ENU.exe goto ENDecho %1goto END:NOPARAMecho Approved updates:for %%f in (%k1%) do if exist WindowsXP-%%f-x86-ENU.exe echo WindowsXP-%%f-x86-ENU.exefor %%f in (%k2%) do if exist WindowsXP-%%f-x86-ENU.exe echo WindowsXP-%%f-x86-ENU.exeecho.echo Missing updates:for %%f in (%k1%) do if not exist WindowsXP-%%f-x86-ENU.exe echo WindowsXP-%%f-x86-ENU.exefor %%f in (%k2%) do if not exist WindowsXP-%%f-x86-ENU.exe echo WindowsXP-%%f-x86-ENU.exeecho.echo Unapproved updates:lfnfor onfor %%i in (WindowsXP-KB*.exe) do call %0 %%i:END Edited May 22, 2013 by jumper Link to comment Share on other sites More sharing options...
Guest Posted May 22, 2013 Share Posted May 22, 2013 Some of them are named IE8-WindowsXP-KB* so can I just do for %%i in (WindowsXP-KB*.exe OR IE8-WindowsXP-KB*.exe) do call %0 %%i?Also "lfnfor on" is a non recognized command. Link to comment Share on other sites More sharing options...
jumper Posted May 22, 2013 Share Posted May 22, 2013 >Some of them are named IE8-WindowsXP-KB* ...Try for %%i in (WindowsXP-KB*.exe IE8-WindowsXP-KB*.exe) do call %0 %%i -or- for %%i in (*WindowsXP-KB*.exe) do call %0 %%i>Also "lfnfor on" is a non recognized command.You can remove it. LFNFOR is only needed to enable long-file-name support in the FOR command on pre-NT versions of Windows and DOS.This code should also work for all versions:cd.>lfnfor.batlfnfor ondel lfnfor.bat Link to comment Share on other sites More sharing options...
Yzöwl Posted May 22, 2013 Share Posted May 22, 2013 allen2 has already pointed you with the obvious solution, FINDSTR /V.As long as you have a local file listing Your updates, lets call it MyList.txt, then the following should suffice:@FOR /F "TOKENS=*" %%# IN ('DIR/B *WINDOWSXP-KB*.EXE^|FINDSTR/VG:MYLIST.TXT') DO @ECHO/%%# IS NOT FROM MY LIST! Link to comment Share on other sites More sharing options...
Guest Posted May 28, 2013 Share Posted May 28, 2013 Thanks all! Link to comment Share on other sites More sharing options...
Guest Posted June 8, 2013 Share Posted June 8, 2013 (edited) allen2 has already pointed you with the obvious solution, FINDSTR /V.As long as you have a local file listing Your updates, lets call it MyList.txt, then the following should suffice:@FOR /F "TOKENS=*" %%# IN ('DIR/B *WINDOWSXP-KB*.EXE^|FINDSTR/VG:MYLIST.TXT') DO @ECHO/%%# IS NOT FROM MY LIST!I found a quirk. If I have WindowsXP-KB2564958-X86-ENU.exe (capital x) in mylist.txt and have WindowsXP-KB2564958-x86-ENU.exe as my file then it flags it as not in the list. Any way to make it case insensitive? Strange because WINDOWSXP-KB from the code is not the same as the updates which use WindowsXP-KB and they are not flagged.Thanks.EDIT: I found the /i switch, ( /I Specifies that the search is not to be case-sensitive.) but when I do FINDSTR/VGI, I get this.D:\Profile\Desktop\WUDFINDSTR: /G ignoredFINDSTR: /: ignoredFINDSTR: /u ignoredFINDSTR: /d ignoredFINDSTR: /a ignoredFINDSTR: /t ignoredFINDSTR: /. ignoredFINDSTR: /t ignoredFINDSTR: /t ignoredFINDSTR: Bad command lineEDIT2: Duh! I changed it to FINDSTR/VIG:updates.txt and all is well! Edited June 8, 2013 by -X- Link to comment Share on other sites More sharing options...
Yzöwl Posted June 8, 2013 Share Posted June 8, 2013 Well done for trying different options, solving your problem and letting us know the outcome.I didn't include the case insensitive switch because I figured you would have created MyList.txt directly from your master directory which I expected would contain file names in the correct case. I fgured that Microsoft would of course maintain that case throughout their various language versions of each update. A better option would be to have a MyList.txt which contains only the seven digit Knowledge Base numbers, KBnnnnnnn. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now