Windows 10, cmd.exe The filename, directory name, or volume label syntax is incorrect

cmd.exewindows 10

I'm facing a strange kind of issue with my Windows 10 machine and couldn't find any solution so far.

Whenever, I open Windows 10 console or any console based application, it shows The filename, directory name, or volume label syntax is incorrect. message even before showing command prompt. Please see image attached below.

I have googled but couldn't find this kind of issue. I'm positive that I'll get some solution by genius people on this forum.

enter image description here

Update: Though I couldn't find any obvious reason of this problem but found a dirty solution and that is to delete current profile. After creating new account on same machine, I couldn't reproduce this issue. It appears that while upgrading my OS, something went wrong.

Best Answer

That was almost certainly caused by a corrupt AutoRun entry.

From the cmd /? help:

If /D was NOT specified on the command line, then when CMD.EXE starts, it looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed first.

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun


HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

Since deleting the profile fixed the problem, it must have been an entry in HKEY_CURRENT_USER. Quite how that entry got there is more of a puzzle, but probably just some sort of glitch.

Related Question