如何将文件内容用作命令行参数Windows [英] How to use file contents as command-line arguments Windows

查看:42
本文介绍了如何将文件内容用作命令行参数Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Bash shell中我可以写

In a Bash shell I can write

some_command $(< some_file)

将some_file的内容作为命令行参数传递给some_command.如何最好在Windows上最好地使用内置命令/语法来完成同一件事?

to pass the contents of some_file to some_command as command-line arguments. How can I best accomplish the same thing on Windows, preferably using built-in commands/syntax?

为澄清起见,some_file中的任何形式的空格都应视为参数分隔符,就像我的Bash示例中的情况一样.特别是,即使some_file有多行,这也需要工作.

To clarify, any form of whitespace in some_file should be treated as argument separators as is the case in my Bash example. In particular, this needs to work even if some_file has multiple lines.

推荐答案

set /p ARGS= <some_file
some_command %ARGS%

这篇关于如何将文件内容用作命令行参数Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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