gosherm Posted November 19, 2005 Share Posted November 19, 2005 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) Link to comment Share on other sites More sharing options...
BoardBabe Posted November 19, 2005 Author Share Posted November 19, 2005 Aha, that's why theres two names Thank you, it's just what I need...! Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted November 25, 2005 Share Posted November 25, 2005 (edited) @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, 2005 by MOONLIGHT SONATA Link to comment Share on other sites More sharing options...
Yzöwl Posted November 25, 2005 Share Posted November 25, 2005 (edited) @ 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, 2005 by Yzöwl Link to comment Share on other sites More sharing options...
Bilou_Gateux Posted November 26, 2005 Share Posted November 26, 2005 Added to my growing collection of Yzöwl awesome script to do whatever you want with a nice small piece of code. Link to comment Share on other sites More sharing options...
MOONLIGHT SONATA Posted November 26, 2005 Share Posted November 26, 2005 @ 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. 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