[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: OT but somewhat relevant: & in file names



Reply to note from "Patricia M. Godfrey"  Sat,
04 Aug 2007 19:01:03 -0400

Patricia:

> All through Win 9x, I have been able to name folders, say,
> VBS&BAT, and CD and DIR them from the DOS prompt. My book on XP
> (Windows XP in a Nutshell, O'Reilly) says that ampersand is
> still a legal character in a file name, and in W2K and XP I can
> create a folder named VBS&BAT from Explorer, and open it there,
> but I cannot CD to it or get a DIR listing of it from the cmd
> prompt. In fact, I cannot reference it in 9x using cmd.exe.
> What on earth is going on?

The ampersand is a reserved character in CMD.EXE syntax, used to
execute multiple commands seriatim, as in

DIR MY.TXT & ECHO. & TYPE MY.TXT

If you want to reference the ampersand qua text character in a
command, you have to "escape" it with a carat (^), as in

CD VBS^&BAT

Give it a try.

--
Carl Distefano
cld@xxxxxxxx