Under Windows, the system root directory could be like C:// or D:// (when the OS is installed in driver D:/). How to get this folder in Go?
如何在Google Golang中获取Windows的系统根目录?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
doubi4340 2016-12-21 03:46关注You could use
filepath.VolumeName(os.GetEnv("SYSTEMROOT")) + "\\"or the shorteros.GetEnv("SYSTEMDRIVE") + "\\". Thewindirenvironment variable probably shouldn't be used anymore honestly since it is not a system-controlled environment variable.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报