Visual Stdio 2019 生成的Windows kits文件夹如何移动到其他盘

本文详细介绍了一种将VisualStudio2019安装过程中产生的WindowsKits文件夹从默认位置移动到其他磁盘的方法,包括关闭所有程序、移动文件夹、删除原始文件夹以及在管理员模式下的命令提示符中使用mklink命令创建链接的具体步骤。

安装visual stdio 2019的时候,我基本上是安装到D盘的,后来发现D盘莫名其妙多出来一个“Windows kits”,让我这个强迫症难以忍受,于是到网上找教程,发现真的可以移动的。

How to move Windows Kits Folder to other disks?

Try the following technique:

  • Close all programs, move the “Windows Kits” folder to another disk, for example to “D:\Windows Kits”; remove the original folder.
  • Start the “Command Prompt (Admin)”. It can be found in Start menu. If you find “PowerShell (Admin)”, then start it and execute “cmd”. Then run the command:

   mklink /J "C:\Program Files (x86)\Windows Kits" "D:\Windows Kits"

You should re-see “Windows Kits” at original location on disk C, but now it is a “junction” and does not take space. The programs do not need re-configuration.

移动Windows kits文件夹

找到你安装的Windows kits的文件夹,然后把它整个截切到想要移动的地方。

比如说,我就是把"D:\Windows kits"整个剪切到"D:\DevelopmentTool\VisualStdio2019\Windows Kits"。

PS:需要注意的是这里是剪切文件夹,而不是复制,不然在你cmd下使用mklink提示“文件已经被创建”。

运行cmd管理员模式

按“win + Q” 然后键入“cmd”,点击右边的“以管理员身份运行”

 

然后在命令栏中输入

mklink /J  "D:\Windows Kits"  “D:\DevelopmentTool\VisualStdio2019\Windows Kits”   

在你原来的地方D盘下面会出现一个快捷方式,然后打开visual stdio 2019 运行一个程序,发现可以编译通过,这样就表示成功了。

 

PowerShell 7 环境已加载 (版本: 7.5.2) PowerShell 7 环境已加载 (版本: 7.5.2) PS C:\Users\Administrator\Desktop> cd E:\PyTorch_Build\pytorch PS E:\PyTorch_Build\pytorch> .\pytorch_env\Scripts\activate (pytorch_env) PS E:\PyTorch_Build\pytorch> # 进入您的 SDK 安装目录 (pytorch_env) PS E:\PyTorch_Build\pytorch> cd E:\Windows\ Kits\10\ Set-Location: A positional parameter cannot be found that accepts argument 'Kits\10\'. (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> # 列出 Include 和 Lib 目录下的所有文件夹,它们就是版本号 (pytorch_env) PS E:\PyTorch_Build\pytorch> echo "Include 目录下的版本号:" Include 目录下的版本号: (pytorch_env) PS E:\PyTorch_Build\pytorch> Get-ChildItem -Path .\Include\ -Name | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+' } Get-ChildItem: Cannot find path 'E:\PyTorch_Build\pytorch\Include\' because it does not exist. (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> echo "`nLib 目录下的版本号:" Lib 目录下的版本号: (pytorch_env) PS E:\PyTorch_Build\pytorch> Get-ChildItem -Path .\Lib\ -Name | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+' } Get-ChildItem: Cannot find path 'E:\PyTorch_Build\pytorch\Lib\' because it does not exist. (pytorch_env) PS E:\PyTorch_Build\pytorch> # 进入正确的 SDK 安装目录(注意路径中没有空格) (pytorch_env) PS E:\PyTorch_Build\pytorch> cd "E:\Windows Kits\10" Set-Location: Cannot find path 'E:\Windows Kits\10' because it does not exist. (pytorch_env) PS E:\PyTorch_Build\pytorch> # 检查 E 是否有 Windows Kits 文件夹 (pytorch_env) PS E:\PyTorch_Build\pytorch> Test-Path "E:\Windows Kits\10" False (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> # 如果返回 False,让我们在整个 E 搜索 Windows Kits 文件夹 (pytorch_env) PS E:\PyTorch_Build\pytorch> Get-ChildItem -Path E:\ -Recurse -Directory -ErrorAction SilentlyContinue | Where-Object {$_.Name -eq "Windows Kits"} | Select-Object -First 5 Directory: E:\Program Files (x86) Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 2025/9/1 2:02 Windows Kits (pytorch_env) PS E:\PyTorch_Build\pytorch> # 进入正确的 Windows Kits 目录 (pytorch_env) PS E:\PyTorch_Build\pytorch> cd "E:\Program Files (x86)\Windows Kits\10" (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> # 列出 Include 和 Lib 目录下的版本号 (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> echo "Include 目录下的版本号:" Include 目录下的版本号: (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> Get-ChildItem -Path .\Include\ -Name | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+' } 10.0.26100.0 (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> echo "`nLib 目录下的版本号:" Lib 目录下的版本号: (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> Get-ChildItem -Path .\Lib\ -Name | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+' } 10.0.26100.0 (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> # 返回 PyTorch 目录 (pytorch_env) PS E:\Program Files (x86)\Windows Kits\10> cd E:\PyTorch_Build\pytorch (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> # 使用您找到的实际版本号设置环境变量(请将 10.0.26100.0 替换为您实际的版本号) (pytorch_env) PS E:\PyTorch_Build\pytorch> $version = "10.0.26100.0" (pytorch_env) PS E:\PyTorch_Build\pytorch> $env:INCLUDE = "E:\Program Files (x86)\Windows Kits\10\Include\$version\ucrt;E:\Program Files (x86)\Windows Kits\10\Include\$version\um;E:\Program Files (x86)\Windows Kits\10\Include\$version\shared;$env:INCLUDE" (pytorch_env) PS E:\PyTorch_Build\pytorch> $env:LIB = "E:\Program Files (x86)\Windows Kits\10\Lib\$version\um\x64;E:\Program Files (x86)\Windows Kits\10\Lib\$version\ucrt\x64;$env:LIB" (pytorch_env) PS E:\PyTorch_Build\pytorch> (pytorch_env) PS E:\PyTorch_Build\pytorch> # 验证环境变量是否设置正确 (pytorch_env) PS E:\PyTorch_Build\pytorch> echo "INCLUDE: $env:INCLUDE" INCLUDE: E:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt;E:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um;E:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared; (pytorch_env) PS E:\PyTorch_Build\pytorch> echo "LIB: $env:LIB" LIB: E:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\um\x64;E:\Program Files (x86)\Windows Kits\10\Lib\10.0.26100.0\ucrt\x64; (pytorch_env) PS E:\PyTorch_Build\pytorch> # 继续编译 (pytorch_env) PS E:\PyTorch_Build\pytorch> cmake --build build --target install -- -k 0 Error: E:/PyTorch_Build/pytorch/build is not a directory (pytorch_env) PS E:\PyTorch_Build\pytorch>
09-02
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值