Trait std::os::windows::process::CommandExt1.16.0[][src]

pub trait CommandExt: Sealed {
    fn creation_flags(&mut self, flags: u32) -> &mut Command;
fn force_quotes(&mut self, enabled: bool) -> &mut Command;
fn raw_arg<S: AsRef<OsStr>>(
        &mut self,
        text_to_append_as_is: S
    ) -> &mut Command; }
This is supported on Windows only.
Expand description

特定于 Windows 的 process::Command 构建器扩展。

这个 trait 是封闭的:它不能在标准库之外实现。 这是为了将来的附加方法不会破坏更改。

Required methods

设置要传递给 CreateProcess进程创建标志

这些将始终与 CREATE_UNICODE_ENVIRONMENT 进行或运算。

🔬 This is a nightly-only experimental API. (windows_process_extensions_force_quotes #82227)

强制所有参数用 (") 引号括起来。

这对于将参数传递给基于 MSYS2/Cygwin 的可执行文件很有用:这些程序将通过搜索与通配符模式匹配的任何文件路径来扩展包含通配符 (?*) 的不带引号的参数。

将参数传递给使用 msvcrt 的程序时,添加引号无效。这包括使用 MinGW 和 MSVC 构建的程序。

🔬 This is a nightly-only experimental API. (windows_process_extensions_raw_arg #29494)

将字面量文本追加到命令行,无需任何引用或转义。

这对于将参数传递给 cmd.exe /c 很有用,它不遵循 CommandLineToArgvW 转义规则。

Implementors