When I double any batch file (even something as simple as "echo test") in the explorer or from anywhere else (windows 10 ONLY in my user account). I get this error message:
The filename, directory name, or volume label syntax is incorrect.
If I right click the batch file and run it as an admin, it will run with no problem. Opening a cmd.exe and running the file with ./test.bat will also works. It seem it's a problem with the file associations?
If I run assoc to get the ProgId, the entry with .bat is the following:
.bat=batfile
If I check the executable associated with the batfile ProgId (ftype | find "batfile), I get this:
batfile="%1" %*
I've tried changing the executable associated with the batfile ProgId to
cmd.exe /c "%1" %*
in the registry (HKEY_CLASSES_ROOT\batfile\shell\open\command) and it does seem to work, but is it really right answer to this?
I have also used procmon to see the difference with the fix and without it.
With cmd.exe as progId
Event Path: *C:\Users\User\test.bat*\
Process Path: *C:\WINDOWS\system32\cmd.exe*\
Process Command: *"cmd.exe" /c "C:\Users\User\test.bat*\
Without it (default)
Event Path: *C:\Windows\System32\"C:\Users\User\test.bat"*\
Process Path: *C:\WINDOWS\system32\svchost.exe*\
Process Command: *C:\WINDOWS\system32\svchost.exe -k netsvcs -p -s Appinfo*