I want to create a hard link to a file using golang. os.Link () tells me that windows are not supported. So I tried to use os.exec to call "mklink.exe".
cmd := exec.Command("mklink.exe", "/H", hardlink_path, file_path) err := cmd.Run()
However, this tells me that it cannot find mklink.exe in% PATH%. This makes me think, as I can call it with cmd.
Then I tried calling it indirectly via cmd:
cmd := exec.Command("cmd.exe", "mklink.exe", "/H", hardlink_path, file_path) err := cmd.Run()
Now it does not return any errors, however it also does not create a hard link. Any suggestions?
source share