/errors/cmd/the-system-cannot-find-the-file-specified
cmd: The system cannot find the file specified.
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
- tool
- Command Prompt (cmd)
- exit code
- 1
- versions
- Windows 10, Windows 11, Windows Server 2016+
- os
- windows
The system cannot find the file specified. is Windows system error 2 (ERROR_FILE_NOT_FOUND): the folder part of the path exists, but there is no file with that name in it. If a folder in the path is missing, cmd prints The system cannot find the path specified (error 3) instead. Run dir /b in the folder and compare the real name, including its extension.
Reproduce it
type notes.txt 2>&1
echo type: ERRORLEVEL=%ERRORLEVEL%
copy notes.txt backup.txt 2>&1
echo copy: ERRORLEVEL=%ERRORLEVEL%
> "notes.txt.txt" echo hidden extension
dir /b *.txt
type "notes.txt.txt"Output
The system cannot find the file specified. type: ERRORLEVEL=1 The system cannot find the file specified. copy: ERRORLEVEL=1 notes.txt.txt hidden extension
The last lines show a common cause: in Explorer with "File name extensions" off, notes.txt.txt is displayed as notes.txt.
Fixes
- Check the real name:
dir /b, ordir /b *notes*when unsure. Turn on View > Show > File name extensions in Explorer. - Check the current folder:
cdwithout arguments prints it. Batch files started from Explorer or Task Scheduler do not start in the script's folder; usecd /d "%~dp0"or full paths built on%~dp0. - Quote paths with spaces:
type "C:\My Files\notes.txt". - Programs started with
start, services and scheduled tasks show this error as a dialog or in their logs when the executable path is wrong. Check the path in the task or service definition.
Sources
Related pages
errors · cmdcmd: The system cannot find the path specified.cmd prints The system cannot find the path specified when a folder in the path is missing, a path with spaces is unquoted, or AutoRun names a bad path.commands · cmdwhere: find which executable runs for a command in Windows (like which)where name lists every match in the current folder and PATH in search order, and the first one is what cmd runs. In PowerShell type where.exe instead.errors · cmd'x' is not recognized as an internal or external command, operable program or batch file.cmd prints this when the name you typed is not a built-in command and no matching .exe, .cmd or .bat exists in the current folder or any PATH directory.