Function std::os::windows::fs::symlink_file1.1.0[][src]

pub fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(
    original: P,
    link: Q
) -> Result<()>
This is supported on Windows only.
Expand description

Creates a new symlink to a non-directory file on the filesystem.

The link path will be a file symbolic link pointing to the original path.

The original path should not be a directory or a symlink to a directory, otherwise the symlink will be broken. Use symlink_dir for directories.

This function currently corresponds to CreateSymbolicLinkW. Note that this may change in the future.

Examples

use std::os::windows::fs;

fn main() -> std::io::Result<()> {
    fs::symlink_file("a.txt", "b.txt")?;
    Ok(())
}
Run