cmd.exe and file name conversion from comman line argument

h_ono@ot.olympus.co.jp h_ono@ot.olympus.co.jp
Fri Jul 27 09:15:00 GMT 2018


Thank you

> From: Marco Atzeri <marco.atzeri@gmail.com>

> what happen if you use bash ?

With cmd + bash, the problem does not occur, but I would like to use cmd 
without bash, if possible.


> From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
> To: cygwin@cygwin.com
> Date: 2018/07/27 14:25
> Subject: Re: cmd.exe and file name conversion from comman line argument
> Sent by: cygwin-owner@cygwin.com

> Under a Unix shell, both double quote " and single quote/apostrophe ' 
are
> quoting metacharacters, as is backquote/grave `, but any character may 
be used
> in a file name by prefixing with the escape character \.
> Under Windows cmd only double quote " is a quoting metacharacter; path 
spec
> delimiters : \ /, wild card characters * ?, and redirection 
> characters | < > are
> also not allowed in file names. So to create a Windows file name with a 
space
> from cmd, use only double quotes " around the name.

Thank you. quoting only the space character worked, which seems to solve
my problem.

from cmd, with LANG environment variables set to ja_JP.UTF-8

c:\cygwin\home\hiroo> touch ああ" "あ

or

c:\cygwin\home\hiroo> touch ああ' 'あ

gives a file named ああ あ.

The rest may be superfluous, but just to compare with.
Quoting Japanese characters too did not work.

c:\cygwin\home\hiroo> touch "あああ"

gives

c:\cygwin\home\hiroo> ls
'"あああ"'

(and shown as ・あああ・ in explorer)

while

c:\cygwin\home\hiroo> touch "aaa"

gives

c:\cygwin\home\hiroo> ls
aaa

Doing

c:\cygwin\home\hiroo> echo > "あああ"

(in this case, the file name is surely processed by cmd)
gives a file named あああ (without quotes).


> Under Cygwin, any file name characters disallowed by Windows are mapped 
into
> Unicode private use area characters, but converted back on display, so 
under
> Windows programs those files' long names will display characters without
> assigned glyphs.
> 
> Note that in ls, nongraphic characters in a file name entry e.g. space, 
causes
> that file name entry to be displayed single quoted 'a b'; specifying ls
> -N|--literal|--quoting-style=literal omits the single quotes, but 
nongraphic
> characters are displayed on terminals as question marks ?, unless
> --show-control-chars is also specified.
> Run "info ls 'Formatting the file names'" to see full explanations.
> 
> -- 
> Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
> 

---------
Hiroo Ono
B‹KCB”›Ø›[H™\ܝΈ‹ËØÞYÝÚ[‹˜ÛÛKܛ؛[\Ëš[B‘TNˆ‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘ØÝ[Y[][ÛŽˆ‹ËØÞYÝÚ[‹˜ÛÛKÙØÜËš[B•[œÝXœØÜšX™H[™›Îˆ‹ËØÞYÝÚ[‹˜ÛÛKÛ[ÈÝ[œÝXœØÜšX™K\Ú[\CBƒB


More information about the Cygwin mailing list