cmdquestion
cmdquestion

Reputation: 83

Double backslash in cmd directory handling

Due to sometimes empty variables within a cmd-script I get directory definitions with doubled backslashes (\\). Example:

SET "Mp3OutDir=%Mp3Root%\%AlbumDir%\%AlbumArtist1stChar%\%AlbumArtistSort_VDN%\[%Year%] %Album_VDN%"

leads, if %AlbumDir% is not defined by user within the procedure, to something like

mkdir "D:\Public\Music\Mp3CDRips\\G\Gabriel, Peter"

This seems to work without errors but I'm curious if a term like this is permitted by the cmd-interpreter.

Cheers, Martin

Upvotes: 8

Views: 7717

Answers (1)

unclemeat
unclemeat

Reputation: 5197

The cmd interpreter seems to ignore extra back slashes in directory names. For example:

C:\>cd Windows\\\\\\\\\\\System32

This will still change the directory to C:\Windows\System32>.

So to answer your question, yes, a term like that is permitted by the cmd interpreter. As to why, I'm not sure.

Upvotes: 5

Related Questions