Page 1 of 1

How to create a Batch program deleting files having the same extension

Posted: 29 Mar 2021 15:57
by Letonnerre
Batch Programming

Hello! I am trying to write a batch program which can delete all files having the same extensions anywhere in my computer location C: and on my desktop. But when it does work.

Here is the first bat file I've done but nothing happen after launching.

@echo off
del "C:\*.vsdx" /s /q

I have programed another one that I've tested:

@echo off
del "H:\*.vsdx" /s /q
del "C: \*.vsdx" /s /q
del "F:\*.vsdx" /s /q
del "Desktop:\*.vsdx" /s /q

Concerning this program, after running it I noticed that .vsdx files in device H and F desappear. But files in the location C: and some others that I've created in Documents do not dissapear. So I'm askinf your help on how to solve this issue.

Summary of problem: I want to write a batch file which can delete all files having the same extension from my computer. Thanks in advance

Re: How to create a Batch program deleting files having the same extension

Posted: 30 Mar 2021 06:29
by ShadowThief
It's probably a permissions issue since you're telling it to start in the root of C:\. Try running the script as administrator.

Re: How to create a Batch program deleting files having the same extension

Posted: 30 Mar 2021 06:52
by Squashman