<s>
forfiles	B-Application
is	O
a	O
computer	O
software	B-Application
utility	I-Application
for	O
Microsoft	B-Application
Windows	I-Application
,	O
which	O
selects	O
files	O
and	O
runs	O
a	O
command	B-Application
on	O
them	O
.	O
</s>
<s>
The	O
command	B-Application
specifier	O
supports	O
some	O
special	O
syntax	O
options	O
.	O
</s>
<s>
It	O
can	O
be	O
used	O
directly	O
on	O
the	O
command-line	B-Application
,	O
or	O
in	O
batch	O
files	O
or	O
other	O
scripts	B-Language
.	O
</s>
<s>
The	O
forfiles	B-Application
command	B-Application
was	O
originally	O
provided	O
as	O
an	O
add-on	O
,	O
in	O
the	O
Windows	B-Device
98	I-Device
,	O
Windows	B-Device
NT	I-Device
and	O
Windows	B-Application
2000	I-Application
Resource	O
Kits	O
.	O
</s>
<s>
It	O
became	O
a	O
standard	O
utility	B-Application
with	O
Windows	B-Application
Vista	I-Application
,	O
as	O
part	O
of	O
the	O
new	O
management	O
features	O
.	O
</s>
<s>
The	O
forfiles	B-Application
command	B-Application
has	O
several	O
command-line	B-Application
switches	O
.	O
</s>
<s>
If	O
no	O
switches	O
or	O
parameters	O
given	O
,	O
it	O
outputs	O
the	O
name	O
of	O
every	O
file	O
in	O
the	O
current	B-Application
directory	I-Application
.	O
</s>
<s>
Switch	O
Argument	O
Meaning	O
/P	O
pathname	O
The	O
directory	B-Application
(	O
folder	O
)	O
to	O
search	O
for	O
files	O
in	O
.	O
</s>
<s>
The	O
default	O
is	O
the	O
current	B-Application
directory	I-Application
.	O
</s>
<s>
/M	O
searchmask	O
A	O
glob	B-Language
pattern	I-Language
(	O
wildcard	O
search	O
)	O
.	O
</s>
<s>
Only	O
files	O
whose	O
filename	B-Device
matches	O
the	O
pattern	O
are	O
selected	O
.	O
</s>
<s>
The	O
file	O
extension	O
is	O
included	O
in	O
the	O
filename	B-Device
;	O
the	O
path	O
(	O
folder	B-Application
name	I-Application
)	O
is	O
not	O
.	O
</s>
<s>
This	O
option	O
treats	O
glob	B-Language
patterns	I-Language
and	O
differently	O
.	O
</s>
<s>
/S	O
(	O
none	O
)	O
Selects	O
matching	O
files	O
in	O
subdirectories	B-Application
.	O
</s>
<s>
By	O
default	O
,	O
only	O
the	O
single	O
,	O
specified	O
directory	B-Application
is	O
searched	O
.	O
</s>
<s>
/C	O
command	B-Application
Execute	O
the	O
given	O
command	B-Application
for	O
each	O
matching	O
file	O
.	O
</s>
<s>
The	O
command	B-Application
string	O
typically	O
needs	O
to	O
be	O
wrapped	O
in	O
double	O
quotes	O
.	O
</s>
<s>
See	O
below	O
for	O
the	O
syntax	O
within	O
the	O
command	B-Application
string	O
.	O
</s>
<s>
The	O
default	O
command	B-Application
is	O
,	O
which	O
causes	O
the	O
name	O
of	O
each	O
matching	O
file	O
to	O
be	O
output	O
(	O
displayed	O
)	O
.	O
</s>
<s>
(	O
none	O
)	O
Displays	O
a	O
help	B-Protocol
message	I-Protocol
(	O
brief	O
usage	O
instructions	O
)	O
.	O
</s>
<s>
Suppresses	O
file	O
search/command	O
execution	O
.	O
</s>
<s>
The	O
command	B-Application
string	O
is	O
executed	O
as	O
given	O
,	O
except	O
as	O
noted	O
below	O
.	O
</s>
<s>
Sequences	O
of	O
the	O
form	O
,	O
where	O
"	O
0x	O
"	O
is	O
literal	O
,	O
and	O
"	O
FF	O
"	O
represents	O
any	O
two-digit	O
hexadecimal	O
number	O
,	O
are	O
replaced	O
with	O
the	O
corresponding	O
single-byte	O
value	O
.	O
</s>
<s>
This	O
can	O
be	O
used	O
to	O
embed	O
non-printing	O
ASCII	B-Protocol
characters	I-Protocol
,	O
or	O
extended	B-Protocol
ASCII	B-Protocol
characters	I-Protocol
.	O
</s>
<s>
Using	O
the	O
0x	O
sequence	O
form	O
described	O
previously	O
,	O
can	O
also	O
be	O
used	O
,	O
which	O
additionally	O
hides	O
the	O
from	O
the	O
command	B-Application
interpreter	O
.	O
</s>
<s>
Several	O
variables	O
are	O
provided	O
,	O
to	O
be	O
used	O
in	O
the	O
command	B-Application
as	O
placeholders	O
for	O
the	O
values	O
from	O
each	O
file	O
.	O
</s>
<s>
Variables	O
are	O
technically	O
not	O
required	O
,	O
but	O
must	O
be	O
used	O
if	O
the	O
command	B-Application
is	O
to	O
vary	O
for	O
each	O
file	O
.	O
</s>
<s>
@relpath	O
Path	O
of	O
the	O
matching	O
item	O
,	O
double	O
quoted	O
,	O
and	O
relative	O
to	O
the	O
starting	O
directory	B-Application
(	O
given	O
by	O
/P	O
)	O
.	O
</s>
<s>
@isdir	O
Evaluates	O
to	O
the	O
literal	O
string	O
if	O
the	O
matching	O
item	O
is	O
a	O
directory	B-Application
,	O
or	O
if	O
not	O
.	O
</s>
<s>
@fsize	O
Size	O
of	O
the	O
matching	O
item	O
,	O
in	O
bytes	B-Application
.	O
</s>
<s>
Directories	B-Application
report	O
a	O
size	O
of	O
zero	O
.	O
</s>
<s>
The	O
following	O
command	B-Application
selects	O
all	O
log	O
files	O
( *	O
.LOG	O
)	O
in	O
the	O
Windows	O
directory	B-Application
30	O
days	O
or	O
older	O
,	O
and	O
lists	O
them	O
with	O
their	O
date	O
.	O
</s>
<s>
The	O
following	O
command	B-Application
would	O
delete	B-Device
the	O
same	O
files	O
.	O
</s>
<s>
The	O
use	O
of	O
is	O
required	O
in	O
the	O
above	O
examples	O
,	O
as	O
both	O
and	O
are	O
internal	O
to	O
the	O
command	B-Device
processor	I-Device
,	O
rather	O
than	O
external	O
utility	B-Application
programs	I-Application
.	O
</s>
