| Crates.io | win-open |
| lib.rs | win-open |
| version | 0.1.2 |
| created_at | 2024-12-21 23:41:46.919115+00 |
| updated_at | 2024-12-22 03:06:37.025451+00 |
| description | Open a path or URL using the program configured on windows system |
| homepage | https://github.com/win-rs/win-open |
| repository | https://github.com/win-rs/win-open |
| max_upload_size | |
| id | 1491554 |
| size | 35,693 |
The win-open crate allows you to open files or URLs using the default program configured on your Windows system. It supports three shells: Command Prompt, PowerShell, and NuShell.
Add the win-open crate to your Cargo.toml:
[dependencies]
win-open = "0.1.0"
To open a URL or file with the default application, use the that function:
win_open::that("https://rust-lang.org");
To open something with a specific application (for example, opening a URL with Firefox):
win_open::with("https://rust-lang.org", "firefox");
In addition to the library functionality, this crate also provides a command-line tool. You can use this tool to open files or URLs directly from the terminal.
To use the binary, run the following command:
cargo run 'file_or_url_to_open'
This will open the provided file or URL using the system's default program or the specified application.
The crate offers basic error handling to notify you if the opening operation fails. For more information, refer to the API documentation.
The implementation of this crate is based on the functionality from Cargo, but has been improved to offer additional error handling and support for different shells on Windows.
The core idea was inspired by open, which provides a simple interface for opening files and URLs in a platform-specific manner.