我写了一个批处理文件来启动一个应用程序(该应用程序不是我的,我不能修改它).批处理文件本身接受一些参数.该应用程序接受其他参数.批处理文件使用SHIFT消耗其所有选项,然后使用正确的环境启动应用程序并将其余参数传递给应用程序.调用批处理文件的示例:
script.bat -opt-1 -opt-2 /opt-a /opt-b=value
Run Code Online (Sandbox Code Playgroud)
在该示例中,script.bat使用"-opt-1"和"-opt-2".最后,它必须使用参数"/ opt-a"和"/ opt-b = value"调用原始应用程序.应用程序期望最后一个参数中的"="符号,我无法更改它.当我直接从命令行调用应用程序时,它运行良好.
但是当我从脚本调用它时,应用程序会收到"/ opt-b = value"的两个参数:"/ opt-b"和"value".如果我在调用应用程序时使用"%*",则会保留"="符号,但会传递所有参数(包括使用SHIFT跳过的参数).
有没有办法只传递最后一个参数并保留"="符号?
我试图在 Asciidoc 文档的表格单元格中有一个(简单的)无序列表。我用asciidoctor。
我尝试了以下方法:
|===
| One | Two
| Foo
|
- Bar
- Baz
|===
Run Code Online (Sandbox Code Playgroud)
但这会导致最后一个单元格仅将文本- Bar - Baz作为简单字符串,没有列表格式。我希望将其格式化为一个列表,分两行,每行都有一个项目符号。任何想法?
我使用HTTPie来 POST 多部分/表单数据请求(传递选项-f)。它包括一个文件字段(使用选项@)。多部分请求的相应部分有一个pseudo-header Content-Disposition,但没有pseudo-header Content-Type。
如何Content-Type为特定文件添加这样的?
为了完整起见,以下是我现在发送的内容(如图所示-p B):
--xyz
Content-Disposition: form-data; name="file"; filename="file.txt"
Hello, world!
This is the content of the file.
--xyz
Run Code Online (Sandbox Code Playgroud)
但这是我需要发送的内容:
--xyz
Content-Disposition: form-data; name="file"; filename="file.txt"
Content-Type: text/plain
Hello, world!
This is the content of the file.
--xyz
Run Code Online (Sandbox Code Playgroud)
或者换句话说,就像 CURL 等效选项:-F "file=file.txt;type=text/plain"。