•  Greatis •  Security •  AppDatabase •  Utilities •  Delphi/CB •  Visual Basic • .NET •  Outsourcing
Hot offer
Subscribe to our news!    Subscribe to our news!
Home Download Order Support   Newsletter ?
 forfiles.exe - Utilities - Vista

We recommend! Click Here to Update All your PC's Outdated drivers

forfiles.exe is a part of Windows Vista.

Relate to: System utility, File system, Console, Programming

Default location: %WinDir%\System32\forfiles.exe

Useful information about: forfiles.exe

Description: ForFiles - Executes a command on selected files

Version: 6.0.6000.16386 (vista_rtm.061101-2205)

Size: 43520 (42K)

MD5: 616C45D1C16C6BF1CFC5F5764F88A4E6

Forfiles.exe selects a file (or set of files) and executes a command on that file. This is helpful for batch jobs.


FORFILES [/P pathname] [/M searchmask] [/S]

[/C command] [/D [+ | -] {MM/dd/yyyy | dd}]

Parameter List:

/P pathname Indicates the path to start searching.

The default folder is the current working

directory (.).

/M searchmask Searches files according to a searchmask.

The default searchmask is '*' .

/S Instructs forfiles to recurse into

subdirectories. Like "DIR /S".

/C command Indicates the command to execute for each file.

Command strings should be wrapped in double


The default command is "cmd /c echo @file".

The following variables can be used in the

command string:

@file - returns the name of the file.

@fname - returns the file name without


@ext - returns only the extension of the


@path - returns the full path of the file.

@relpath - returns the relative path of the


@isdir - returns "TRUE" if a file type is

a directory, and "FALSE" for files.

@fsize - returns the size of the file in


@fdate - returns the last modified date of the


@ftime - returns the last modified time of the


To include special characters in the command

line, use the hexadecimal code for the character

in 0xHH format (ex. 0x09 for tab). Internal

CMD.exe commands should be preceded with

"cmd /c".

/D date Selects files with a last modified date greater

than or equal to (+), or less than or equal to

(-), the specified date using the

"MM/dd/yyyy" format; or selects files with a

last modified date greater than or equal to (+)

the current date plus "dd" days, or less than or

equal to (-) the current date minus "dd" days. A

valid "dd" number of days can be any number in

the range of 0 - 32768.

"+" is taken as default sign if not specified.

/? Displays this help message.


To find every text file on the C: drive

FORFILES -pC: \ -s -m*.TXT -c"CMD /C Echo @FILE is a text file"

To show the path of every HTML file on the C: drive

FORFILES -pC: \ -s -m*.HTML -c"CMD /C Echo @RELPATH is the location of @FILE"

List every folder on the C: drive

FORFILES -pC: \ -s -m*. -c"CMD /C if @ISDIR==TRUE echo @FILE is a folder"

For every file on the C: drive list the file extension in double quotes

FORFILES -pc: \ -s -m*.* -c"CMD /c echo extension of @FILE is 0x22@EXT0x22"

List every file on the C: drive last modified over 100 days ago

FORFILES -pc: \ -s -m*.* -d-100 -c"CMD /C Echo @FILE : date >= 100 days"

Find files last modified before 01-Jan-1995

FORFILES -pc: \ -s -m*.* -d-010195 -c"CMD /C Echo @FILE is quite old!"


'0x22' is hex 22 - the double quote character - put these around any long filenames.

Slow computer? Speed up your Windows boot process with Startup Optimizer
Try RegRun Suite for free. It helps...

Constantly updated. Last update: October 13 2008

Would you like to add your opinion?

Your Name (Not Required):

Your E-mail to contact (Not Required):

Application Name:

Application Status:
At your option


More info:
Quick Links
What's new?

RSS Feed

Ask Experts

Join forum


Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | Outsourcing

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2007 Greatis Software

eXTReMe Tracker