找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 18978|回复: 1

[其他] printf.exe

[复制链接]
发表于 2013-5-11 08:17:54 | 显示全部楼层 |阅读模式
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技术 +1 收起 理由
lxzzr + 1 多谢分享

查看全部评分

发表于 2013-8-1 11:06:36 | 显示全部楼层
顶一个,我对win下格式化输出始终不能很好的解决,有了它问题就好办多了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 04:47 , Processed in 0.017158 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表