diff --git a/src/nvm.go b/src/nvm.go index 3863487d..3f334475 100644 --- a/src/nvm.go +++ b/src/nvm.go @@ -375,7 +375,7 @@ func use(version string, cpuarch string) { // Create or update the symlink sym, _ := os.Stat(env.symlink) if sym != nil { - cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink) + cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", filepath.Clean(env.symlink)) var output bytes.Buffer var _stderr bytes.Buffer cmd.Stdout = &output @@ -387,7 +387,7 @@ func use(version string, cpuarch string) { } } - c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", env.symlink, filepath.Join(env.root, "v"+version)) + c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", filepath.Clean(env.symlink), filepath.Join(env.root, "v"+version)) var out bytes.Buffer var stderr bytes.Buffer c.Stdout = &out