Windows 隐藏磁盘

一 、 查看磁盘详细信息

1 、Win10 查看磁盘详细信息批处理,文本编辑保存为,bat批处理文件

  • 如果不能运行,请手动给予管理员权限运行
1
2
3
4
5
6
7
8
9
10
11
12
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
rem 上面是bat批处理以管理员权限运行
rem 下面是参看磁盘详细信息的命令
echo list volume > commands.txt
echo exit >> commands.txt
diskpart /s commands.txt > output.txt
type output.txt
del commands.txt
del output.txt
pause

2 、Win11 查看磁盘详细信息批处理,文本编辑保存为,bat批处理文件

  • 如果不能运行,请手动给予管理员权限运行
1
2
3
4
5
6
7
8
9
10
11
12
13
@ echo off
%1 %2
ver|find "5.">nul&&goto :Admin
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
:Admin
rem 上面是bat批处理以管理员权限运行
rem 下面是参看磁盘详细信息的命令
echo list volume > commands.txt
diskpart /s commands.txt > output.txt
type output.txt
del commands.txt
del output.txt
pause

二 、 Windows 隐藏磁盘(数据不会丢失)

  • 以上面查看到的【卷0】【R盘】为例

1 、Win10 隐藏磁盘批处理,文本编辑保存为,bat批处理文件

  • 如果不能运行,请手动给予管理员权限运行
1
2
3
4
5
6
7
8
9
10
11
12
13
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
rem 上面是bat批处理以管理员权限运行
rem 下面是隐藏【卷0】【R盘】的命令
echo list volume > script.txt
echo select volume=0 >> script.txt
echo remove letter=R >> script.txt
DiskPart /s script.txt
del script.txt
rem 添加提示
echo 操作已完成,请按任意键继续...
pause >nul

2 、Win11 隐藏磁盘批处理,文本编辑保存为,bat批处理文件

  • 如果不能运行,请手动给予管理员权限运行
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
@ echo off
%1 %2
ver|find "5.">nul&&goto :Admin
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
:Admin
rem 上面是bat批处理以管理员权限运行
rem 下面是隐藏【卷0】【R盘】的命令
echo list volume > script.txt
echo select volume=0 >> script.txt
echo remove letter=R >> script.txt
DiskPart /s script.txt
del script.txt
rem 添加提示
echo 操作已完成,请按任意键继续...
pause >nul

三 、 Windows 显示磁盘(数据不会丢失)

1 、Win10 显示磁盘批处理,文本编辑保存为,bat批处理文件

  • 如果【R盘】已经被占用,可任意修改一个没占用的驱动器号。
1
2
3
4
5
6
7
8
9
10
11
12
13
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
rem 上面是bat批处理以管理员权限运行
rem 下面是【卷0】重新挂载到【R盘】
echo list volume > script.txt
echo select volume=0 >> script.txt
echo assign letter=R >> script.txt
DiskPart /s script.txt
del script.txt
rem 添加提示
echo 操作已完成,请按任意键继续...
pause >nul
  • 如果不能运行,请手动给予管理员权限运行

2 、Win11 显示磁盘批处理,文本编辑保存为,bat批处理文件

  • 如果【R盘】已经被占用,可任意修改一个没占用的驱动器号。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ echo off
%1 %2
ver|find "5.">nul&&goto :Admin
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
:Admin
rem 上面是bat批处理以管理员权限运行
rem 下面是【卷0】重新挂载到【R盘】
echo list volume > script.txt
echo select volume=0 >> script.txt
echo assign letter=F >> script.txt
DiskPart /s script.txt
del script.txt
echo 操作已完成,请按任意键继续...
pause >nul
  • 如果不能运行,请手动给予管理员权限运行