Batch file to delete all *.exe except for one

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

sulasno

Thread Starter
Joined
Jul 3, 2010
Messages
162
is there a command available ? my workaround is to rename donotdelete.exe to donotdelete.bat; run a batch file to delete all *.exe and then rename donotdelete.bat to donotdelete.exe is there a more elegant solution ? tia
 

eddie5659

Moderator
Malware Specialist
Joined
Mar 19, 2001
Messages
37,277
I'm a little curious, but why do you want to delete all exe's on a system?
 
Joined
Jul 6, 2010
Messages
619
maybe use the /a switch after using the proper attrib command to set the attributes to suit your purpose??
 

sulasno

Thread Starter
Joined
Jul 3, 2010
Messages
162
for %%i in (*.exe) do if not "%%i"=="Downloader.exe" del /q "%%i" I simply put the above in the directory and all exe files are deleted except for Downloader.exe
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top