The ren (or rename) command in Windows Command Prompt renames files and folders. Simple, fast, and works on every Windows version from XP to 11. Here’s the canonical syntax:
This guide covers single-file renames, folder renames, wildcards for batch jobs, and the PowerShell alternative when ren isn’t enough.
Introduction to the REN command
ren is a built-in Windows command — no install, available from any cmd.exe prompt. The syntax:
ren [drive:][path]filename1 filename2
Key points:
- Renames files and folders (single command for both)
- Supports wildcards (
*,?) for batch operations - Use quotes for names with spaces
- Can’t move files to a different folder — for that, use
moveinstead renameis an alias forren— both work identically
Basic usage
Rename a single file
Rename with a full path
Rename a folder
Names with spaces
Wrap both arguments in double quotes:
Change a file extension
ren handles extensions like any other rename — you just include the dot:
Batch renaming with wildcards
* matches any sequence of characters; ? matches a single character.
Change extension for all matching files
Rename in a sequence
For numbered files, a for loop is the cleanest approach:
When ren falls short — PowerShell
For find-and-replace inside filenames, regex patterns, or recursive renames, PowerShell beats ren:
Common pitfalls
| Symptom | Cause | Fix |
|---|---|---|
| ”The system cannot find the file specified” | Old filename doesn’t exist (or you’re in the wrong folder) | dir first to confirm the file exists |
| ”Access denied” | File is open in another program, or permissions issue | Close the program, or open Command Prompt as Administrator |
| Rename works but file disappears | You renamed it to a hidden extension; explorer hides extensions by default | Toggle “File name extensions” in Explorer’s View tab |
| Wildcard rename does nothing | No files match the pattern in the current folder | Run dir *.txt first to verify matches |
Quick reference
| Task | Command |
|---|---|
| Rename one file | ren old.txt new.txt |
| Rename one folder | ren oldfolder newfolder |
| Names with spaces | ren "old name" "new name" |
| Change extension | ren file.txt file.bak |
| Add extension | ren noext file.txt |
| Batch by extension | ren *.txt *.bak |
| Numbered sequence | for /L %i in (1,1,10) do ren file%i.txt new%i.txt |
| PowerShell regex | Get-ChildItem *.txt | Rename-Item -NewName { $_.Name -replace 'X','Y' } |
Conclusion
The ren command is a 30-year-old fixture of Windows for good reason — it’s simple, fast, and built in. For one-off renames it’s faster than any GUI. For batch jobs, the * wildcard handles 90% of cases. For anything beyond — recursive renames, regex find-and-replace — switch to PowerShell.
Most-used forms to memorize:
ren old.txt new.txt— single fileren "name with spaces" "new name"— with quotesren *.txt *.bak— wildcard batchGet-ChildItem ... | Rename-Item ...— PowerShell when you need more