Skip to main content

open_with_default

Function open_with_default 

Source
pub fn open_with_default(target: impl AsRef<Path>) -> Result<()>
Expand description

Opens a file or directory with the user’s default Windows handler.

§Errors

Returns Error::InvalidInput 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_default(r"C:\Windows\notepad.exe")?;