Successfully escape a token delimiter in a fully qualified command path!
Posted: 04 May 2019 22:37
I had always understood that you cannot escape token delimiters - only quotes will work. I suppose I knew that the token delimiter is initially escaped in phase 2, but in a subsequent phase (execution phase 7, possibly others) the token delimiter cannot be escaped. So even if you escape a space in phase 2, it does no good.
But then I saw Stephan's comments at https://stackoverflow.com/q/55978586/1012053.
I did some tests with the following
c:\test\abc xyz.bat
I was shocked that the following works:
But if you remove the leading c:, I get the result I expect:
Note also that the space must be escaped in phase 2. Even a fully qualified path does not work without the escape
Dave Benham
But then I saw Stephan's comments at https://stackoverflow.com/q/55978586/1012053.
I did some tests with the following
c:\test\abc xyz.bat
Code: Select all
@echo OK
Code: Select all
c:\test\>c:\test\abc^ xyz.bat
OK
Code: Select all
C:\test\>\test\abc^ xyz.bat
'\test\abc' is not recognized as an internal or external command,
operable program or batch file.
Code: Select all
C:\test>c:\test\abc xyz.bat
'c:\test\abc' is not recognized as an internal or external command,
operable program or batch file.
Dave Benham