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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Letonnerre
Posts: 1
Joined: 29 Mar 2021 15:55

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

#1 Post by Letonnerre » 29 Mar 2021 15:57

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

ShadowThief
Expert
Posts: 1015
Joined: 06 Sep 2013 21:28
Location: Virginia, United States

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

#2 Post by ShadowThief » 30 Mar 2021 06:29

It's probably a permissions issue since you're telling it to start in the root of C:\. Try running the script as administrator.


Post Reply