Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Batch job

Posted on 2004-10-25
Medium Priority
Last Modified: 2012-05-05
I created batch job which I need to delete certain files with extension *.chg.Those files are located on "H" partition.This what I have :
rem This will delete all .chg files
del :*.chg /s
When I try to run this job the batch job is not performing like it should...Any idea where is the problem
Question by:mirekg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 20

Expert Comment

by:Dufo G. Belski
ID: 12399872
What is C:\cd\ supposed to do?  Try remming that line out and just go with

del :*.chg /s
LVL 11

Expert Comment

ID: 12400093
I would recommend trying every line oh the batch in a DOS shell, anyhow, I think that your colon is unnecessary; try using:
del *.chg /s
LVL 20

Expert Comment

by:Dufo G. Belski
ID: 12400292
Oops, good point, elbereth21.
LVL 11

Accepted Solution

elbereth21 earned 750 total points
ID: 12400366
Sadly, that is the kind of mistakes I make in my own batch files... :-)
LVL 23

Expert Comment

by:Danny Child
ID: 12408862
you also might want to consider the FORFILES.EXE server resource kit tool

FORFILES -ph:\ -s -m*.chg -c"CMD /C del @FILE"

-p = path
-s = include subdirs
-m = match filetype
-d = age in days (can also be set as an absolute date ie DDMMYYYY)
-c = command to execute

Note there are no spaces between the switches and their arguments.

info here:
Download it here:

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question