VS 2022之前的版本均为32位,其安装目录有以下几个:
C:\Program Files (x86)\Microsoft SDKs
C:\Program Files (x86)\Microsoft Visual Studio
C:\Program Files (x86)\Windows Kits
C:\ProgramData\Microsoft\VisualStudio
C:\ProgramData\Package Cache
以D:\Visual Studio
目录为例,首先在该目录下创建Microsoft SDKs, Microsoft Visual Studio, Windows Kits, VisualStudio, Package Cache
五个目录,然后按以下命令创建链接:
mklink /D "C:\Program Files (x86)\Microsoft SDKs" "D:\Visual Studio\Microsoft SDKs"
mklink /D "C:\Program Files (x86)\Microsoft Visual Studio" "D:\Visual Studio\Microsoft Visual Studio"
mklink /D "C:\Program Files (x86)\Windows Kits" "D:\Visual Studio\Windows Kits"
mklink /D "C:\ProgramData\Microsoft\VisualStudio" "D:\Visual Studio\VisualStudio"
mklink /D "C:\ProgramData\Package Cache" "D:\Visual Studio\Package Cache"
创建完成后,在C盘对应的位置就会出现各目录的链接,指向D盘中对应位置。
Visual Studio 2022之前的版本均为64位,其安装目录与之前版本不同,实测仅安装C++
组件时用到了以下目录:
C:\Program Files\Microsoft Visual Studio
C:\Program Files (x86)\Microsoft SDKs
C:\Program Files (x86)\Microsoft Visual Studio
C:\Program Files (x86)\Windows Kits
C:\ProgramData\Microsoft\VisualStudio
C:\ProgramData\Package Cache
接下来按照相同的方法,先在目标位置创建目录,再用mklink
创建链接。为防止安装其他组件时会用到其他目录,索性把C:\Program Files\Microsoft SDKs, C:\Program Files (x86)\Windows Kits
也算上。
mklink /D "C:\Program Files (x86)\Microsoft SDKs" "D:\Visual Studio\Microsoft SDKs"
mklink /D "C:\Program Files (x86)\Microsoft Visual Studio" "D:\Visual Studio\Microsoft Visual Studio"
mklink /D "C:\Program Files (x86)\Windows Kits" "D:\Visual Studio\Windows Kits"
mklink /D "C:\Program Files\Microsoft SDKs" "D:\Visual Studio\Microsoft SDKs x64"
mklink /D "C:\Program Files\Microsoft Visual Studio" "D:\Visual Studio\Microsoft Visual Studio x64"
mklink /D "C:\Program Files\Windows Kits" "D:\Visual Studio\Windows Kits x64"
mklink /D "C:\ProgramData\Microsoft\VisualStudio" "D:\Visual Studio\VisualStudio"
mklink /D "C:\ProgramData\Package Cache" "D:\Visual Studio\Package Cache"