Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Delete all .exe files in a folder?

Hello guys,

Can someone assist me, I need to delete all the .exe files in one specific folder without deleting the subfolder into it. Preferably a 1 liner command.

Is it possible to delete that exe file even it its running? By force delete?

Thanks!
Well you could search in the folder for ".exe", then CTRL + A, and then delete all.

Or if you really want to use batch, try

Code
del /Q *.exe
^make sure the batch file is in the folder containing the EXE files.
DEL https://ss64.com/nt/del.html
/S Delete from all Subfolders (DELTREE)
/Q Quiet mode, do not give a Yes/No Prompt before deleting.
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
You don't have to do it in batch but you can do it in CMD/Powershell. Just hold Shift and right click inside the folder. In the context menu, you'll see open CMD window here or Open Powershell window here. click that and issue the cmd provided by Sir-Teabag.

Code
del /Q *.exe


Ok after testing in powershell, the command is

Code
remove-item *.exe
There's no place like ~/
How about kill all task on a specific folder ?
(Jun 7, 2018 07:24 PM)boykanyon123 Wrote:  How about kill all task on a specific folder ?

For that, you may need a little more advanced looping sequence. How many tasks are there? you might have to do them individually
(Jun 8, 2018 05:56 AM)Sir-Teabag Wrote:  For that, you may need a little more advanced looping sequence. How many tasks are there? you might have to do them individually

Lets just say 2 task on a specific folder? Do i have to manual it?
(Jun 8, 2018 09:15 AM)boykanyon123 Wrote:  Lets just say 2 task on a specific folder? Do i have to manual it?

Well whatever is easier. Personally I would manually do it but you can use Batch if you want.

First, find the PID number of the programs you want to terminate, inside the control panel. (pic at bottom)

Then inside your batch file, add this
Code
@echo off
taskkill /F /PID <PID number goes here>
taskkill /F /PID <Second PID number goes here>

So for example, if i wanted to end GyazoStation task, I would use
Code
taskkill /F /PID 10152
. Since the number 10152 represents the task I'm wanting to kill

[Image: SnippingTool_2018-06-08_21-33-53.png]

Hope that helps!
(Jun 7, 2018 09:26 AM)Sir-Teabag Wrote:  Well you could search in the folder for ".exe", then CTRL + A, and then delete all.

Or if you really want to use batch, try

Code
del /Q *.exe
^make sure the batch file is in the folder containing the EXE files.

(Jun 8, 2018 01:37 PM)Sir-Teabag Wrote:  Well whatever is easier. Personally I would manually do it but you can use Batch if you want.

First, find the PID number of the programs you want to terminate, inside the control panel. (pic at bottom)

Then inside your batch file, add this
Code
@echo off
taskkill /F /PID <PID number goes here>
taskkill /F /PID <Second PID number goes here>

So for example, if i wanted to end GyazoStation task, I would use
Code
taskkill /F /PID 10152
. Since the number 10152 represents the task I'm wanting to kill

[Image: SnippingTool_2018-06-08_21-33-53.png]

Hope that helps!

PID changes doesn't it? If I'm correct you're going to want to terminate the process by name instead of PID. I use /f because I'm forceful...I don't know if it actually makes a difference.

Code
taskkill /im processname.exe /f
There's no place like ~/
(Jun 8, 2018 08:24 PM)b00st3d Wrote:  PID changes doesn't it?  If I'm correct you're going to want to terminate the process by name instead of PID.  I use /f because I'm forceful...I don't know if it actually makes a difference.

Code
taskkill /im processname.exe /f

Ah my bad, you're right! Sorry OP, use the process name instead of the PID, like mentioned above. 🤦‍♂ ✌
(Jun 7, 2018 09:26 AM)Sir-Teabag Wrote:  Well you could search in the folder for ".exe", then CTRL + A, and then delete all.

Or if you really want to use batch, try

Code
del /Q *.exe
^make sure the batch file is in the folder containing the EXE files.

t y , . .


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by DOSuser2018Nov 28, 2018 01:00 PM 13 465 Nov 28, 2018 01:00 PM
Last Post: iTHX
[.NET] by Kyle17Nov 29, 2017 02:54 AM 4 322 Nov 29, 2017 02:54 AM
Last Post: Kyle17
[Shell] by PhloxApr 5, 2017 02:43 AM 0 158 Apr 5, 2017 02:43 AM
Last Post: Phlox