[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[其他] printf.exe

Usage:
  printf.exe [Options]
  printf.exe FORMAT [ARGUMENT] ...

Print ARGUMENT(s) according to FORMAT.

FORMAT controls the output as in C printf. Interpreted sequences are:
  \OOO         character with octal value OOO
  \xHH         character with hex value 0xHH
  \uHHHH       Unicode character with hex value 0xHHHH
  \\           backslash
  \a           audible BEL
  \b           backspace
  \f           form feed
  \n           new line
  \r           return
  \t           horizontal tab
  \v           vertical tab
  \PQOALGUISE  (%"'&<>^| =)
  %%           a single %
  %b           ARGUMENT as a string with '\' escapes interpreted

and all C format specifications ending with one of diouxXfeEgGcs,
with ARGUMENTs converted to proper type first. Variable widths are handled.
Positional parameters (%n$... *m$) are handled too.

If there are more string operands than format specifiers, the format string is
reused from the beginning. If there are fewer string operands than format specif
iers,
then string specifiers are treated as if empty strings were supplied,
numeric conversions are treated as if 0 was supplied.

Options:
  --help        display this help and exit
  --version     output version information and exit
  --cp=CodePage set output code page

Examples:
  printf "%5d%4d\n" 1 21 321 4321 54321
  printf "%s, %s %d, %d:%.2d\n" %weekday% %month% %day% %hour% %min%
  printf "%1$s, %3$d. %2$s, %4$d:%5$.2d\n" monday october 4 17 41
  printf "%1$s :: %1$f :: %1$'f :: %1$,f" 1234567.123456789


示例:
C:\>printf \u547d\u4ee4\u884c
命令行


注:

  • UnxUtils 中 printf.exe 不支持转换 \uHHHH;
  • coreutils 中的 printf.exe 可以转换 \uHHHH,但是需要依赖 libiconv2.dll libintl3.dll。


-------------------------------
官网: http://code.google.com/p/mini-gnu/
-------------------------------

http://bcn.bathome.net/s/tool/index.html?key=printf
1

评分人数

    • lxzzr: 多谢分享技术 + 1

顶一个,我对win下格式化输出始终不能很好的解决,有了它问题就好办多了

TOP

返回列表