Closed azzamsa closed 2 years ago
You can only (and only need to) do this on Windows. On your system adding a shebang to your script should be enough.
From docs at https://rust-script.org/#executable-scripts:
Executable Scripts
On Unix systems, you can use #!/usr/bin/env rust-script as a shebang line in a Rust script. This will allow you to execute a script files (which don’t need to have the .rs file extension) directly.
If you are using Windows, you can associate the .ers extension (executable Rust - a renamed .rs file) with rust-script. This allows you to execute Rust scripts simply by naming them like any other executable or script.
This can be done using the rust-script --install-file-association command. Uninstall the file association with rust-script --uninstall-file-association.
If you want to make a script usable across platforms, use both a shebang line and give the file a .ers file extension.
You can only (and only need to) do this on Windows. On your system adding a shebang to your script should be enough.
Oh, Thank you!
Hi.
rust-script fails to install file association.