Or cmd /v:on but it will work only with xp and latter ok we should use delayed expansion but we should in this case escape !
try cmd /v /c printf "%s\n" foo!CR!bar' | od -t x1 see http://stackoverflow.com/a/4095133 for order of extension On Thu, May 10, 2012 at 2:06 PM, Bruno Haible <br...@clisp.org> wrote: > Bastien ROUCARIES wrote: >> Something like this >> >> ^^^%NL%%NL%^%NL%%CR% > > No, this does not work either. > > $ export NL=' > ' > > $ eval `echo "export CR='_'" | tr '_' '\r'` > > $ echo "$NL" | od -t x1 > 0000000 0a 0a > 0000002 > > $ echo "$CR" | od -t x1 > 0000000 0d 0a > 0000002 > > $ cmd.exe /c 'printf "%s\n" foo^%NL%%NL%bar' | od -t x1 > 0000000 66 6f 6f 0a 62 61 72 0a > 0000010 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%^%NL%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%^%CR%%NL%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%^%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%CR%^%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 5e 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%CR%^%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 5e 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%CR%^%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 5e 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%CR%%NL%^%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 5e 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%^%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%%CR%%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%NL%%NL%%CR%%CR%%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%CR%%NL%%NL%%CR%%CR%%CR%%CR%bar' | od -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > $ cmd.exe /c 'printf "%s\n" foo^^^%CR%%NL%%CR%%NL%%CR%%CR%%CR%%CR%bar' | od > -t x1 > 0000000 66 6f 6f 5e 0a 62 61 72 0a > 0000011 > > Bruno >