Skip to main content

open_with_verb

Function open_with_verb 

Source
pub fn open_with_verb(verb: &str, target: impl AsRef<Path>) -> Result<()>
Expand description

Opens a file or directory using a specific Windows shell verb.

Common verbs include open, edit, print, and properties, depending on what the target path’s registered handler supports.

§Errors

Returns Error::InvalidInput if verb is empty, whitespace only, or contains NUL bytes, or if target is empty or contains NUL bytes. Returns Error::PathDoesNotExist if the target path does not exist. Returns Error::WindowsApi if ShellExecuteW reports failure.

§Examples

win_desktop_utils::open_with_verb("properties", r"C:\Windows\notepad.exe")?;