Jump to content

Recommended Posts


Posted (edited)

@Boardbabe & Gosherm,

Nice effort from both of you. however, i still have problems. here's my code:

=================================================

Attrib -R -H -S %WinDir%\*.bmp

for /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 by MOONLIGHT SONATA
Posted (edited)

@ MOONLIGHT SONATA

These 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 :EOF

just 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 by Yzöwl

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...