forfiles.exe

Windows Command-Line Tool

Application ProcessSafeSystem Utility
CPU Usage
0-2%
Memory
5-15 MB per run
Location
C:\Windows\System32
Publisher
Microsoft Corporation

Quick Answer

forfiles.exe is safe. It's a legitimate Windows command-line utility for batch processing files based on criteria, used by admins in scripts and maintenance tasks.

Is it a Virus?
✔ NO - Safe
Must be in C:\Windows\System32\forfiles.exe or C:\Windows\SysWOW64\forfiles.exe
Warning
Batch operations can spawn commands
forfiles runs a command on each matching file; scripts can create multiple processes
Can I Disable?
✔ YES
forfiles.exe is not a background service; avoid running it from scheduled tasks to disable usage

What is forfiles.exe?

forfiles.exe is a Windows command‑line utility that batches file operations by criteria such as date, size, and name. It can execute a command on each matching file without opening folders, streamlining maintenance scripts.

forfiles.exe scans directories, applies filters, and runs a specified command for every file that matches. It relies on CMD syntax and can recursively process subfolders via /P and /D options.

Quick Fact: ForFiles debuted in Windows to automate repetitive file chores, enabling batch delete, copy, or rename actions from a single command.

Types of ForFiles Processes

Is forfiles.exe Safe?

Yes, forfiles.exe is safe when it originates from Microsoft and resides in the Windows system directory.

Is forfiles.exe a Virus or Malware?

The real forfiles.exe is NOT a virus. Malware may masquerade with similar names; verify signature and path.

How to Tell if forfiles.exe is Legitimate or Malware

  1. File Location: Must be in C:\Windows\System32\forfiles.exe or C:\Windows\SysWOW64\forfiles.exe. Any other path is suspicious.
  2. Digital Signature: Right-click the file in Explorer → Properties → Digital Signatures. Should show "Microsoft Windows" or "Microsoft Corporation" as signer.
  3. Resource Usage: Normally light; a single invocation uses minimal CPU and memory. Unusually high usage during idle periods is suspicious.
  4. Behavior: Should only run when invoked by an explicit forfiles command or a scheduled task.

Red Flags: If forfiles.exe appears outside System32/SysWOW64, lacks a signature, or runs continually without a task, scan for malware and verify via Windows Defender or Defender Offline.

Why Is forfiles.exe Running on My PC?

forfiles.exe runs when batch maintenance tasks are executed or scheduled by IT, not as a continuous service. It launches to apply commands to matching files.

Reasons it's running:

Can I Disable or Remove forfiles.exe?

Yes, you can disable forfiles.exe usage. Since it’s a utility, you only need to stop invoking it in scripts or scheduled tasks.

How to Stop forFiles.exe

How to Uninstall ForFiles Utility

Common Problems: Batch Processing Issues

If forfiles.exe behaves unexpectedly or returns errors:

Common Causes & Solutions

Quick Fixes:
1. Run forfiles in a test directory with a safe command to verify syntax
2. Use /P to specify the correct path and /S for subfolders if intended
3. Add -m to include multiple masks or -d <days> to filter by date
4. Run as Administrator when permissions are required
5. Review output logs to confirm actions

Frequently Asked Questions

Is forfiles.exe safe?

Yes, forfiles.exe is a legitimate Windows utility used for batch file processing. Ensure the file is located at C:\Windows\System32\forfiles.exe or C:\Windows\SysWOW64\forfiles.exe and has a valid signature.

What does forfiles.exe do?

ForFiles filters files by criteria and runs a command for each match. It’s commonly used in scripts to delete, move, or rename files based on date or size.

How do I delete files older than 30 days with forfiles.exe?

Use a command like forfiles /P "C:\Path" /D -30 /C "cmd /c del @path". Test with echo first to verify results.

Where is forfiles.exe located?

Typically in C:\Windows\System32\forfiles.exe (and C:\Windows\SysWOW64\forfiles.exe on 64-bit systems).

Can I disable forfiles.exe?

Yes. Stop calling it from scripts or scheduled tasks; it isn’t a background service.

Does forfiles.exe require admin rights?

Administrative rights are needed if the target operations affect protected folders or require elevated permissions.

Related Processes