轻松赚钱 - 使用间接而不是文件将字符串写入命令
Easy money - write string to command using indirection instead of a file
我知道我可以使用
C:\> somecommand.exe < somefile.txt
要将 somefile.txt 的内容发送到指定的命令,但是如果不是发送文件,我想发送一个预先打包的字符串,例如:
C:\> somecommand.exe < "this is a test"
我试过了,还有:
C:\> somecommand.exe < echo "this is a test"
运气不好。
此外,如果您有 Linux/Mac 的示例,那将是最有帮助的。
您可以像这样将 pipe |
与 echo
结合使用:
C:\> echo this is a test | somecommand.exe
我删除了引号,因为它们也会传递给命令。
我知道我可以使用
C:\> somecommand.exe < somefile.txt
要将 somefile.txt 的内容发送到指定的命令,但是如果不是发送文件,我想发送一个预先打包的字符串,例如:
C:\> somecommand.exe < "this is a test"
我试过了,还有:
C:\> somecommand.exe < echo "this is a test"
运气不好。
此外,如果您有 Linux/Mac 的示例,那将是最有帮助的。
您可以像这样将 pipe |
与 echo
结合使用:
C:\> echo this is a test | somecommand.exe
我删除了引号,因为它们也会传递给命令。