Windows 11 Doesn't Delete Files Run Command? Fix
In this article
- Why the Run Dialog Ignores File Deletion
- How to Actually Delete Files Using Run
- Common Delete Command Errors and Fixes
- Deleting Folders vs. Files
- Run vs. Command Prompt vs. PowerShell: What's the Difference?
- Safety: Permanent Deletion and the Recycle Bin
- Alternatives to Command-Line Deletion
- Frequently Asked Questions
If you typed del or a file path into the Run dialog (Win+R) and Windows 11 didn't delete anything, that's expected: the Run dialog is a program launcher, not a file deletion tool. To actually delete files from Run, you must use the cmd or powershell command to open a terminal first, then run a delete command inside it. This article explains exactly why Run behaves this way, how to delete files via command line, and what to do when the delete command itself fails.
Why the Run Dialog Ignores File Deletion
The Run dialog (Win+R) executes a single command line as if you typed it into Command Prompt, but with one key difference: it only launches programs or opens documents, and it does not process built-in shell commands like del, copy, or move. When you type del C:\file.txt into Run, Windows looks for a program named "del" and finds none, so it shows an error like "Windows cannot find 'del'."
This is a common misconception because Run can open folders and files. For example, typing notepad opens Notepad, and typing C:\Users opens that folder in File Explorer. But deletion is a shell operation, not a launch operation. To delete via Run, you must first launch a command interpreter (cmd.exe or PowerShell) and then issue the delete command inside that interpreter.
How to Actually Delete Files Using Run
The correct way to delete files from the Run dialog is to open a terminal with a command that includes the deletion instruction. Here are three reliable methods:
- Use cmd with /c: Press Win+R, type
cmd /c del "C:\path\to\file.txt"and press Enter. The/cflag tells cmd to execute the command and then close. The quotes are essential if the path contains spaces. - Use PowerShell with -Command: Press Win+R, type
powershell -Command "Remove-Item 'C:\path\to\file.txt'"and press Enter. PowerShell'sRemove-Itemis the equivalent ofdel. - Open a terminal first: Press Win+R, type
cmd(orpowershell), press Enter, and then type the delete command in the terminal window. This is easier for multiple files or when you need to see the output.
For example, to delete a file named old report.docx from your Desktop, you would type: cmd /c del "C:\Users\YourName\Desktop\old report.docx". Replace YourName with your actual username.
Common Delete Command Errors and Fixes
Even when you use the correct syntax, you may encounter errors. The most frequent ones are:
- "Access is denied": The file is in use by another program, or you lack permission. Close any program that might be using the file (like a Word document or a media player). If it's a system file, you may need to run the command as Administrator (right-click Start > Terminal (Admin)).
- "The system cannot find the file specified": The path is wrong, or the file name has a typo. Check the path in File Explorer's address bar and copy it exactly.
- "The process cannot access the file because it is being used by another process": Same as access denied. Use Task Manager (Ctrl+Shift+Esc) to find and end the process using the file, then retry.
- File is read-only: Use
del /fto force deletion of read-only files. Example:cmd /c del /f "C:\path\to\readonly.txt".
Deleting Folders vs. Files
The del command only removes files, not folders. To delete an entire folder and everything inside it, you need rmdir (or rd) with the /s (recursive) and /q (quiet) flags. From Run, type: cmd /c rmdir /s /q "C:\path\to\folder". This permanently deletes the folder and all contents without confirmation. Be extremely careful: this cannot be undone from the Recycle Bin.
In PowerShell, the equivalent is Remove-Item -Recurse -Force "C:\path\to\folder".
Run vs. Command Prompt vs. PowerShell: What's the Difference?
Run is a lightweight launcher that inherits your current user environment but doesn't persist. Command Prompt (cmd.exe) is a full shell that supports batch scripts and traditional DOS commands like del, copy, and rd. PowerShell is a more modern shell built on .NET, with cmdlets like Remove-Item, and it also accepts many traditional commands as aliases.
When you use cmd /c from Run, you are telling Windows to start a new Command Prompt process, execute the command, and exit. This works, but it's a one-shot operation. If you need to delete multiple files or run complex commands, opening a terminal window is more practical because you can see errors and run several commands in sequence.
Safety: Permanent Deletion and the Recycle Bin
Commands like del, rmdir, and Remove-Item permanently delete files—they do not send them to the Recycle Bin. Once deleted this way, the data is not recoverable through normal Windows interfaces. If you want to delete to the Recycle Bin, use File Explorer (select the file and press Delete) or use the PowerShell Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile method, which sends to Recycle Bin by default.
Always double-check the path before running a delete command. A single typo could delete the wrong file, or worse, if you use wildcards (*.*), an entire directory. For example, cmd /c del C:\*.* would attempt to delete every file in the root of C:, which would fail for system files but could still cause damage. Never run delete commands on system folders like C:\Windows or C:\Program Files unless you are absolutely certain.
Alternatives to Command-Line Deletion
If you find the command line cumbersome, you have several graphical alternatives:
- File Explorer: Select the file/folder and press Shift+Delete to permanently delete, or just Delete to send to Recycle Bin.
- Right-click context menu: Choose Delete from the menu.
- Storage Sense: Windows 11's built-in tool can automatically clean up temporary files and recycle bin contents.
- Third-party file shredders: If you need to securely overwrite data, specialized tools exist, but they are not built into Windows.
For most users, File Explorer is the safest and easiest method. The command line is useful for batch operations, scripting, or when a file is locked and you need to force deletion from an elevated terminal.
Frequently Asked Questions
Why does Run say "Windows cannot find 'del'"?
Because del is an internal command of cmd.exe, not a standalone program. Run only launches executables (.exe, .com, .bat) or opens registered file types. Internal commands are not executable files, so Run doesn't recognize them.
Can I delete a file directly from Run without opening a terminal?
Yes, by using cmd /c del or powershell -Command "Remove-Item" as shown above. This still opens a terminal in the background, but it closes automatically after the command finishes.
How do I delete a file with a space in its name?
You must enclose the full path in double quotes. For example: cmd /c del "C:\My Files\report final.txt". Without quotes, cmd treats the space as a separator and tries to delete a file named "C:\My" which doesn't exist.
What is the difference between del and rmdir?
del removes files only. rmdir (or rd) removes empty directories. To remove a non-empty directory, use rmdir /s, which recursively deletes all files and subfolders. del cannot delete folders.
Is there a way to undo a command-line deletion?
No, not through standard Windows tools. Once deleted via del or Remove-Item, the file is gone from the filesystem. Third-party recovery software might recover it if the disk sectors haven't been overwritten, but there is no built-in undo.
Why does the delete command fail with "Access is denied" even as administrator?
Some system files and folders have special permissions or are protected by Windows Resource Protection. Even an administrator cannot delete them normally. You may need to take ownership of the file first, or the file might be in use by a system process. In such cases, it's safer to leave the file alone.