Bash'printf'等同于命令提示符? [英] Bash 'printf' equivalent for command prompt?

查看:191
本文介绍了Bash'printf'等同于命令提示符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想管道一些字符串输入到一个小的C程序在Windows的命令提示符。在bash中我可以使用

I'm looking to pipe some String input to a small C program in Windows's command prompt. In bash I could use

$ printf "AAAAA\x86\x08\x04\xed" | ./program

基本上,我需要在命令提示符中转义十六进制数字。

Essentially, I need something to escape those hexadecimal numbers in command prompt.

在命令提示符/ powershell中 printf 是否有等效或类似的命令?

Is there an equivalent or similar command for printf in command prompt/powershell?

感谢

推荐答案

在PowerShell中,您可以这样做:

In PowerShell, you would do it this way:

"AAAAA{0}{1}{2}{3}" -f 0x86,0x08,0x04,0xed | ./program

这篇关于Bash'printf'等同于命令提示符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆