Batch job

Posted on 2004-10-25
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
    LVL 24

    Expert Comment

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

    del :*.chg /s
    LVL 11

    Expert Comment

    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 24

    Expert Comment

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

    Accepted Solution

    Sadly, that is the kind of mistakes I make in my own batch files... :-)
    LVL 22

    Expert Comment

    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:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    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…
    With the shift in today’s hiring climate (, many companies are choosing to hire freelancers to get projects completed efficiently and inexpensively…
    Want to pick and choose which updates you receive? Feel free to check out this quick video on how to manage your email notifications.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    856 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now