November 19, 200520 yr Yeah, that's just the one line version of the code... however, it won't work if you need to protect two files (boot.bmp & boot1.bmp)
November 25, 200520 yr @Boardbabe & Gosherm,Nice effort from both of you. however, i still have problems. here's my code:=================================================Attrib -R -H -S %WinDir%\*.bmpfor /F "usebackq tokens=*" %%i in (`dir /b %WinDir%\*.bmp`) do ( if %%i neq "Prairie Wind.bmp" ( if %%i neq "Soap Bubbles.bmp" ( if %%i neq winnt.bmp ( if %%i neq winnt256.bmp ( del /q "%WinDir%\%%i" ) ) ) ))=================================================Result is that, except winnt.bmp and winnt256.bmp, all .bmp(s) are deleted. why it's not saving the other 2 files? what's wrong with my code? Edited November 25, 200520 yr by MOONLIGHT SONATA
November 25, 200520 yr @ MOONLIGHT SONATAThese three lines should do what you want@ECHO OFF&PUSHD %SYSTEMROOT%FOR /F "DELIMS=" %%? IN ('DIR/B/A-D "*.BMP" ^2^>NUL^|FINDSTR/LIVE "PRAIRIE\ WIND.BMP SOAP\ BUBBLES.BMP WINNT.BMP WINNT256.BMP"') DO IF ERRORLEVEL 0 DEL /F/A/Q "%%?"POPD&GOTO :EOFjust remove the @ECHO OFF& and &GOTO :EOF to add to an existing batch file.<Edit>For those of you wishing to alter the code to suit your own preferences, the backslashes in the above code act as escape characters for the spaces in the file names</Edit> Edited November 25, 200520 yr by Yzöwl
November 26, 200520 yr Added to my growing collection of Yzöwl awesome script to do whatever you want with a nice small piece of code.
November 26, 200520 yr @ Bilou Gatex,I endorse your comment on behalf of all the members of MSFN, barring Yzowl (=our "Man Friday"). @ Yzowl,Uff, awesome...what can i say more, i don't know. Nice, & thank you.
Create an account or sign in to comment