Trait std::os::windows::process::CommandExt

1.16.0 · source · []
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; }
Available on Windows only.
Expand description

Windows-specific extensions to the process::Command builder.

This trait is sealed: it cannot be implemented outside the standard library. This is so that future additional methods are not breaking changes.

Required Methods

Sets the process creation flags to be passed to CreateProcess.

These will always be ORed with CREATE_UNICODE_ENVIRONMENT.

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

Forces all arguments to be wrapped in quote (") characters.

This is useful for passing arguments to MSYS2/Cygwin based executables: these programs will expand unquoted arguments containing wildcard characters (? and *) by searching for any file paths matching the wildcard pattern.

Adding quotes has no effect when passing arguments to programs that use msvcrt. This includes programs built with both MinGW and MSVC.

Append literal text to the command line without any quoting or escaping.

This is useful for passing arguments to cmd.exe /c, which doesn’t follow CommandLineToArgvW escaping rules.

Implementors