command line hide disk drive

Recently, the management of the unit has been stricter, and there can be nothing in the computer that is not related to work. In order to prevent the private files in the computer from being easily found during the inspection, I wrote a batch file to hide the disk drive.

@echo  off 
:menu 
echo [H] hide [S] show [X] exit
 set /p yn= Please enter the selection and press Enter to confirm:
 if /i "%yn%"=="h" goto hide
 if /i " %yn%"=="s" goto show
 if /i "%yn%"=="x" exit 
rem ping 0 -n "2">nul ping 0 this address 2 times, the output is redirected to nul 
echo error ! &ping 0 -n "2">nul& cls & goto menu
 :hide 
( echo  select disk 0
 echo  select partition 4
 echo  set id=12)>temp.temp. $
 pause 
exit 
: show 
( echo  select disk 0
 echo  select partition 4
 echo  set id = 7)> temp. $ 
diskpart /s temp. $
 del temp. $
 pause 
exit

 The above command implements partition4 that hides disk0, in which set id=7 is to display the drive letter, id=12 is to hide the drive letter, and other similar operations can be hidden.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324449920&siteId=291194637