/errors/cmd/the-system-cannot-find-the-path-specified
cmd: The system cannot find the path specified.
- tool
- Command Prompt (cmd)
- exit code
- 1
- versions
- Windows 10, Windows 11, Windows Server 2016+
- os
- windows
The system cannot find the path specified. is Windows system error 3 (ERROR_PATH_NOT_FOUND): a folder in the path you gave does not exist. If the folder exists but the file in it does not, Windows reports error 2 instead, The system cannot find the file specified. Check the path piece by piece and quote it if it has spaces.
Reproduce it
cd nosuchdir 2>&1
echo cd: ERRORLEVEL=%ERRORLEVEL%
type nosuchdir\notes.txt 2>&1
nosuchdir\tool.exe 2>&1
echo run: ERRORLEVEL=%ERRORLEVEL%
mkdir nosuchdir
> nosuchdir\notes.txt echo created
type nosuchdir\notes.txtOutput
The system cannot find the path specified. cd: ERRORLEVEL=1 The system cannot find the path specified. The system cannot find the path specified. run: ERRORLEVEL=3 created
cd and type set ERRORLEVEL to 1; starting a program from a missing folder sets it to 3, the system error code.
Common causes and fixes
| Cause | Fix |
|---|---|
| Typo or a folder that does not exist yet | if not exist "out\" mkdir "out" before writing into it |
| Batch file started from another folder (Explorer, Task Scheduler, a service) | cd /d "%~dp0" at the top, or build paths as "%~dp0data\file.txt" |
| Unquoted path with spaces | cd /d "C:\Program Files\App" |
| Other drive | cd /d D:\work (without /d, cd does not switch drive) |
| Message at every cmd start | an AutoRun command is broken; check with cmd /d |
The message appears when cmd opens
cmd runs the commands in the AutoRun value of HKCU\Software\Microsoft\Command Processor and HKLM\Software\Microsoft\Command Processor at startup. If that value points to a script or folder that no longer exists, every new window starts with this message. cmd /d skips AutoRun: if the message disappears, inspect the value:
reg query "HKCU\Software\Microsoft\Command Processor" /v AutoRun
reg query "HKLM\Software\Microsoft\Command Processor" /v AutoRunRemove or correct the value with the Registry Editor (an administrator is needed for the HKLM one).