http://www.techrepublic.com/forums/questions/windows-xp-doesnt-recognize-quotquot-in-path-names-for-dos-apps/ too.
Workaround as you see fit?
Bob
![]() | Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years. Thanks, CNET Support |
Hi If I attempt to cd to any path which includes a directory name using the & symbol then it fails. For example if I try to cd to a directory named test&go I would receive the following message
The system cannot find the path specified, 'go' is not recognised as an internal or external command, operable program or batch file.
Any assistance would be greatfully received.
o/s windows 7 64 bit
Discussion is locked
CMD prompt here.
"
C:\Users\proffitt\Desktop>cd test&go
The system cannot find the path specified.
'go' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\proffitt\Desktop>cd "test&go"
C:\Users\proffitt\Desktop\test&go>
"
As you can read in http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true the ampersand for cmd is a command separator. So in your example it separates the commands (1) cd test and (2) go, which is invalid.
All I can say: this is by design.
Kees
Hello Kees
Thanks for info. Is it not the case that & is a legitimate character for naming a file or folder?
But it's used as a command separator in a command for cmd also. And that has precedence. That's not a bug.
The 4 alternatives
- cd test & cd go
- cd "test&go"
- cd test^&go
- split into 2 lines: cd test and cd go
Choose the one you like most to use.
Kees
Hi Kees. If & had been declared as an invalid character for naming files and folders there would not be an issue. In my case test&go is just a string not an attempt to use multipe commands - cd "test&go" works just fine. I am going to have to brush up my dos commands!! Again thanks for your help.
In that case the parentheses ( and ) should have been disallowed also. But the filename rules for NTFS have been defined before the full syntax of CMD was designed. And it would have been impossible to forbid using them then.
All details about the rules for filenames are documented in https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx#naming_conventions.
All reserved characters had a meaning mentioned there (except possibly the quote used around filenames with a space in a command) already were used in the MS-DOS command interpreter. So adding new ones (like the parentheses and the ampersand in a new version of the language) resulted in this (easy to solve) conflict.
Also note this nice little sentence: "The shell and the file system have different requirements. It is possible to create a path with the Windows API that the shell user interface is not able to interpret properly."
Kees
Hi Kees many thanks for your comprehensive reply esp your last sentence. One lives and learns!!!
Many thanks for your speedy reply bob. This query really resulted from my problems installing the android SDK manager. This ultimately led to me examining a particular batch file called android.bat. Part of this batch file refers to executables whose paths include a directory with an & in it. The easiest way on the face of it would be change the name of the directory but the directory in question is user profile! I have found a reference how to do this but I am always reluctant to step into regedit. It looks as if I may have no choice. Anyway again many thanks for you help
Since it's a batch file, why not add the escape \ or quotes?
Bob
Hi Bob I will have to have a think about what you and other correspondents have told me. I fear I'm not really clear what the android bat file is doing and until I do I will be wasting everyones time in pursuing this issue further. This is the first time I have ever used a forum and I am thankful for all the help received. Bye for now.
But for the command processor it has a special meaning and when we put spaces or other than a-z, 0-9 in names we have to be aware of the command processor.
Bob