in reply to Re^4: Filename Surrounded by Quotes in a Scalar Variable Causes Open to Fail
in thread Filename Surrounded by Quotes in a Scalar Variable Causes Open to Fail

C:\>cd with a space C:\with a space>

I think this is a very special case in cmd.exe (and maybe also in command.com): cd/chdir needs exactly one parameter since MS DOS 1.0, so if it is passed more than one, cmd.exe silently combines them into a single parameter.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^6: Filename Surrounded by Quotes in a Scalar Variable Causes Open to Fail
by syphilis (Archbishop) on Sep 14, 2020 at 13:38 UTC
    I think this is a very special case in cmd.exe

    Yes, it's true that there are shell commands that do need the quotes (eg copy and move) but set is another command that does not need them.
    Running set PATH=%PATH%;C:\with a space works as intended.

    Anyway, it seems to me that the need for quotes is by no means specific to windows.
    Last night I indicated that cd on Windows doesn't need the quotes, though cd on Linux does.
    Tonight, I've noticed that set on Windows doesn't need the quotes, though export on Linux does.

    It's pretty clearly inaccurate to present the need for double quotes as a Windows thing - though I guess it could be argued that Bill wasn't actually claiming it was windows-specific.

    Cheers,
    Rob.