Deletes one or more files permanently.

FileDelete, FilePattern



The name of a single file or a wildcard pattern such as C:\Temp\*.tmp. FilePattern is assumed to be in %A_WorkingDir% if an absolute path isn't specified.

To remove an entire folder, along with all its sub-folders and files, use FileRemoveDir.

Error Handling

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

ErrorLevel is set to the number of files that failed to be deleted (if any) or 0 otherwise. Deleting a wildcard pattern such as *.tmp is considered a success even if it does not match any files; thus ErrorLevel is set to 0.

If files were found, A_LastError is set to 0 (zero) or the result of the operating system's GetLastError() function immediately after the last failure. Otherwise A_LastError contains an error code that might indicate why no files were found.


To send a file to the recycle bin, use the FileRecycle command.

To delete a read-only file, first remove the read-only attribute. For example: FileSetAttrib, -R, C:\My File.txt.

FileRecycle, FileRemoveDir, FileCopy, FileMove


Deletes all .tmp files in a directory.

FileDelete, C:\temp files\*.tmp