Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6697483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:27:54+00:00 2026-05-26T06:27:54+00:00

At first, I know this question probably exists, but on first sight I didn’t

  • 0

At first, I know this question probably exists, but on first sight I didn’t find the answer I was looking for.

I’m having a problem creating a batch-file that should delete multiple files with their specific file format given as a parameter. The folder where these files should be is defined as the first parameter. Read-Only, hidden and system files should be deleted too.

So far I have something like this:

CD %1
IF EXIST *.%2 DEL *.%2  /F /A:H /A:S

But this doesn’t has the result it should have…
Can someone help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:27:55+00:00Added an answer on May 26, 2026 at 6:27 am

    How about…

    CD /D %1
    DEL *.%2  /F /A:H /A:S
    

    The /D by the CD makes sure it also changes the current drive. By default CD will always stay in the same drive, no matter where you want to go.

    Then, the if exist is pointless. If there is nothing to delete, DEL won’t delete anything.

    I’m not sure if *.%2 is really what you want, because it will only match files with no name with a certain extension. You probably want only %2. It is.

    If that doesn’t work, please tell us what happens. You told us the expect result, namely that it should delete files in a given directory matching a given pattern. Tell us what happens instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is probably a first year question, but I'm having some problems
First, yes I know about this question , but I'm looking for a bit
I know this is probably a really simple question but I'm having a brain
I know this question might sound a little cheesy but this is the first
problem euler #5 i found the solution but i don't know why this first
I have this question you probably know the answer... My app is already functional
I know this probably must be a newbie question, but since I don't know
I know this is probably a stupid question, but I wanted to make sure
I know this is probably an easy question but after reviewing the documentation for
I know this is probably a very simple question, but I can't seem to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.