Ot: Windows 7

Kenneth Brody kenbrody at spamcop.net
Wed Aug 6 10:47:58 PDT 2014


On 8/6/2014 1:14 PM, Richard Kreiss wrote:
> Did some testing today on both Windows 7 and Windows XP regarding spaces
> on the command line.
[... "cd" to directory with spaces ...]
> Well, both the commands work without the parentheses on Windows 7.
>
> However cd c:\Program files fails on Windows XP unless quoted.
>
> If you are working in a Windows 7 or greater environment, this can save
> you problems in exporting paths as you don't need to  uses quotes.
>
> Test this on your own machines.
[...]

(I assume you mean "quotes", and not "parentheses".)

You have "command extensions" enabled in your Windows 7 shell.  This is from 
the "cd" help text:

> If Command Extensions are enabled CHDIR changes as follows:
[...]
> CHDIR command does not treat spaces as delimiters, so it is possible to
> CD into a subdirectory name that contains a space without surrounding
> the name with quotes.  For example:
>
>     cd \winnt\profiles\username\programs\start menu
>
> is the same as:
>
>     cd "\winnt\profiles\username\programs\start menu"
>
> which is what you would have to type if extensions were disabled.

Try your XP box with extensions enabled via:

     start cmd /e:on

Note that you would still need quotes for most other commands.  For example, 
you couldn't copy a file from such a path without quotes.

Also, don't forget about the design "feature" of the "start" command when 
dealing with quotes.  If the command name is in quotes, make sure to put an 
empty pair of quotes first.  For example:

     start "\program files\foo\bar.pdf"
versus
     start "" "\program files\foo\bar.pdf"

The first will give you a new command window, with "\program 
files\foo\bar.pdf" as the title.  The later will open the PDF file with the 
default reader.

-- 
Kenneth Brody


More information about the Filepro-list mailing list