Windows Defender (Microsoft Defender Antivirus) and the Windows Security app cannot be configured to arbitrarily treat specific, clean files (such as all PDF files) as viruses just to force-delete them. Defender is designed to detect and act on actual malware and potentially unwanted applications based on its security intelligence and heuristics, not on user-defined “this file type is a virus” rules.
However, Windows Security does allow exclusions (to skip scanning certain files, folders, file types, or processes), not forced detections. Exclusions are the opposite of what is needed here and would only reduce protection, not help delete the files.
To remove files with paths longer than 260 characters, use file-management approaches rather than antivirus, for example:
- Temporarily move a higher-level folder closer to the drive root (for example, from
C:\Users\Name\Documents\Very\Long\PathtoC:\Short), which shortens the full path, then delete the PDFs. - Use command-line tools (like
delorrdfrom an elevated Command Prompt) after shortening the path. - Rename intermediate folders to very short names (like
a,b,c) to reduce the total path length, then delete.
For security tasks, Windows Security and Microsoft Defender Antivirus are intended for scanning and protection, not as a mechanism to bypass file system path-length issues.
References: