| 
 | 
 
功能:禁用或隐藏任意分区(包括解除) 
批处理代码如下: 
复制内容到剪贴板  
代码: 
@echo off 
mode con cols=45 lines=13 
echo. 
title 禁用或隐藏任意分区 by 8250 
set l1=        如果需要继续其他操作请选择y 
set l2=             按任意键退出,感谢使用! 
:main 
cls 
color fc 
echo. 
echo              隐藏或禁用任意分区 
echo. 
echo           核心代码由“BAT”朋友精简 
echo. 
echo          1. 禁用任意分区 
echo          2. 解除禁用任意分区 
echo          3. 隐藏任意分区 
echo          4. 解除隐藏任意分区 
echo          5. 按任意键退出 
echo. 
SET verybat= 
SET /P verybat=     请选择要进行的操作:  
IF /I '%verybat:~0,1%'=='1' GOTO 1 
IF /I '%verybat:~0,1%'=='2' GOTO 2 
IF /I '%verybat:~0,1%'=='3' GOTO 3 
IF /I '%verybat:~0,1%'=='4' GOTO 4 
exit 
:1 
cls 
color 4f 
set regadd=reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 
echo.&echo.&echo.&echo. 
set /p dirv1=    请选择你要禁用的分区: 
set num=2 
set str=c d e f g h i j k l m n o p q r s t u v w x y z 
for %%i in (%str%) do ( 
    set /a num*=2 
    if /i "%%i"=="%dirv1%" goto forbid 
) 
:forbid 
%regadd% /v NoViewOnDrive /t REG_DWORD /d %num% /f 
gpupdate.exe /force >nul 
cls 
echo. 
echo         已成功禁用了"%dirv1%:"分区 
echo. && echo %l1% && echo. && echo %l2% && echo. 
set jx= 
set /p jx= 请选择: 
if /i "%jx%"=="y" goto main 
exit 
:2 
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoViewOnDrive /f >nul 2>nul 
gpupdate /force >nul 
cls 
color 2f 
echo. 
echo   已成功解除任意分区的禁用。 
echo. && echo %l1% && echo. && echo %l2% && echo. 
set jx= 
set /p jx= 请选择: 
if /i "%jx%"=="y" goto main 
exit 
:3 
set regadd=reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 
cls 
color f9 
echo.&echo.&echo.&echo. 
set /p dirv2=    请选择你要隐藏的分区: 
set num=2 
set str=c d e f g h i j k l m n o p q r s t u v w x y z 
for %%i in (%str%) do ( 
    set /a num*=2 
    if /i "%%i"=="%dirv2%" goto hide 
) 
:hide 
%regadd% /v NoDrives /t REG_DWORD /d %num% /f 
gpupdate /force >nul 
cls 
color f5 
echo. 
echo       已成功隐藏了"%dirv2%:"分区 
echo. && echo %l1% && echo. && echo %l2% && echo. 
set jx2= 
set /p jx2= 请选择: 
if /i "%jx2%"=="y" goto main 
exit 
:4 
cls 
color 1f 
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoDrives /f >nul 2>nul 
gpupdate /force >nul 
echo. 
echo      已成功解除任意分区的隐藏。 
echo. && echo %l1% && echo. && echo %l2% && echo. 
set jx2= 
set /p jx2= 请选择: 
if /i "%jx2%"=="y" goto main 
exit 
 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
@echo off 
TITLE 隐藏磁盘批处理 by lwk148440 
:lwk148440 
cls 
COLOR 0A 
echo. 
echo                   ╭────────────────────╮ 
echo         ╭────┤       隐藏磁盘批处理 by lwk148440     ├────╮ 
echo         │        ╰────────────────────╯        │ 
echo         │       提示:请输入选项前面的序号并回车,谢谢使用。         │ 
echo         │                                                            │ 
echo         │                                                            │ 
echo         │        1、 隐藏 D 盘                 2、 隐藏 E 盘         │ 
echo         │                                                            │ 
echo         │        3、 隐藏 F 盘                 4、 隐藏 G 盘         │ 
echo         │                                                            │ 
echo         │        5、 隐藏 H 盘                 6、 隐藏 I 盘         │ 
echo         │                                                            │ 
echo         │        7、 取消 隐藏                 8、 Read Me          │ 
echo         │                                                            │ 
echo         │        9、 离     开                 10、Visit Maker       │ 
echo         │                                                            │ 
echo         │                                                            │ 
echo         ╰──────────────────────────────╯ 
echo. 
set /p list0= 请输入序号: 
if "%list0%"=="1" goto list1 
if "%list0%"=="2" goto list2 
if "%list0%"=="3" goto list3 
if "%list0%"=="4" goto list4 
if "%list0%"=="5" goto list5 
if "%list0%"=="6" goto list6 
if "%list0%"=="7" goto list7 
if "%list0%"=="8" goto list8 
if "%list0%"=="9" goto list9 
if "%list0%"=="10" goto list10 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list1 
cls 
@taskkill /f /IM explorer.exe 
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t reg_binary /d 08000000 /f 
cls 
echo. 
echo      已隐藏 D 盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list2 
cls 
@taskkill /f /IM explorer.exe 
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t reg_binary /d 10000000 /f 
cls 
echo. 
echo      已隐藏 E 盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list3 
cls 
@taskkill /f /IM explorer.exe 
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t reg_binary /d 20000000 /f 
cls 
echo. 
echo      已隐藏 F 盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list4 
cls 
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t reg_binary /d 40000000 /f 
cls 
@taskkill /f /IM explorer.exe 
echo. 
echo      已隐藏 G 盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list5 
cls 
@taskkill /f /IM explorer.exe 
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t reg_binary /d 80000000 /f 
cls 
echo. 
echo      已隐藏 H 盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list6 
cls 
@taskkill /f /IM explorer.exe 
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /t reg_binary /d 00010000 /f 
cls 
echo. 
echo      已隐藏 I 盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list7 
cls 
@taskkill /f /IM explorer.exe 
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v "NoDrives" /f 
cls 
echo. 
echo      已取消隐藏磁盘 
echo. 
echo      请按任意键生效并返回 
pause>nul 
@start %windir%\explorer.exe 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list8 
cls 
echo. 
echo. 
echo. 
echo. 
echo        感谢阁下使用在下花3小时做的这个东东, 
echo. 
echo        本人在爱机(XPSP3,C,D,E,F,G,H,I盘)  
echo. 
echo        上试验通过,估计98、zkzk3也没有问题, 
echo. 
echo        如果你有机会试验并有结果愿意告诉在下 
echo. 
echo       
echo. 
echo. 
echo. 
echo                              2009.04.03 1:10 
echo. 
echo 请按任意键返回 
pause>nul 
goto lwk148440 
rem ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ 
:list9 
@exit 
exit |   
 
 
 
 |