How To Hide OR Unhide Drives Using Batch File



Let's see how can we do that.
RUN THE FILE AS ADMINISTRATOR OR ELSE IT WONT WORK.

Step 1: Create Two Text Files

One for hiding drive and another for unhide any drive.




So,
Here is first text file

select volume %vol%
remove letter %ch%

Save it as Hide.txt where you want .



Second text file

select volume %vol%
assign letter %ch%

Save it as Unhide.txt where you want.

But for convenience save both files at same place.


Step 2: Create Batch File

@echo off
echo Enter Your Choice
echo 1.Hide Drive
echo 2.Unhide Drive
set /p choice=
if %choice%==1 goto 1
if %choice%==2 goto 2

:1
echo Enter Volume number(Volume starts from 0)
set /p vol=
echo Enter drive Letter which you want to hide
set /p ch=
echo Enter drive where Hide.txt exist
set /p drive=

diskpart /s %drive%:\Hide.txt

echo Done
pause
exit



:2
echo Enter Volume number(Volume starts from 0)
set /p vol=
echo Enter drive Letter which you want to unhide
set /p ch=
echo Enter drive where Unhide.txt exist
set /p drive=

diskpart /s %drive%:\Unhide.txt

echo Done
pause 
exit

Save it as Diskpart.bat

And you done it. 

Comments