Computing.Net > Forums > Programming > Batch to find / delete files except one?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch to find / delete files except one?

Reply to Message Icon

Name: verkahd
Date: August 26, 2009 at 12:23:44 Pacific
OS: Windows XP Pro SP3
Subcategory: Batch
Comment:

I'm trying to find a way to more quickly search through a stack of laptops and delete some troublesome copies of wmiprvse.exe, though it's not looking too hard to just delete them all, I really need it to exclude the original found in C:\Windows\system32\wbem. I'm far too much of a code novice to even imagine how to exclude a specific file from such a broad search and destroy command.. Anyone who can spare some time to help?



Sponsored Link
Ads by Google

Response Number 1
Name: Judago
Date: August 26, 2009 at 17:57:58 Pacific
Reply:

This might help...


for /f "delims=" %%a in ('dir /b /s c:\wmiprvse.exe ^| find /i /v "C:\Windows\system32\wbem\wmiprvse.exe"') do (
echo %%a
)


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch to find / delete files except one?

can we find a file in one folder? www.computing.net/answers/programming/can-we-find-a-file-in-one-folder/14587.html

batch to rename txt file using data inside www.computing.net/answers/programming/batch-to-rename-txt-file-using-data-inside/19709.html

Script to move/delete files www.computing.net/answers/programming/script-to-movedelete-files/14985.html