This VBScript sample illustrates how to hide recovery partition or specified partition diskpart(s).
Some organizations want to hide the BCD partition, or the OEM recovery partition.
Step1: Double-click on the script, it will show a Message box to input specified partition letters.

Step2: Enter the partition letter(s), and left click “OK” button. Then it will refresh the windows explorer, and hide the specified partition(s).
Before execute the script

After execute the script

Note:
1. About the input format, you can enter like “d,e” ”d e” “d;e”or anything include letters.
2. If you want to show all hidden partition, you can enter “showall” .Then all partitions will display.
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
For i = 1 To Len(Drive)
substr= Mid(Drive,i,1)
x = 0
For j = Asc("A") To Asc("Z")
If Chr(j) = UCase(substr) Then
'Varify if the input letter duplicate
If InStr(Drive,substr) = InStrRev(Drive,substr) Then
'Varify if the specifid letter exists
If fso.DriveExists(substr) Then
bits = bits + 2^x
Else
wscript.echo "The Drive letter '"&UCase(substr)&"' not exsits!Try again!"
exitcode = 1
Exit For
End If
Else
wscript.echo "Something dupilcate,please try again"
exitcode = 1
End If
End If
x = x + 1
Next
If exitcode = 1 Then
Exit For
End If
Next
For i = 1To Len(Drive) substr= Mid(Drive,i,1) x = 0For j = Asc("A") To Asc("Z") If Chr(j) = UCase(substr) Then'Varify if the input letter duplicateIf InStr(Drive,substr) = InStrRev(Drive,substr) Then'Varify if the specifid letter exists If fso.DriveExists(substr) Then bits = bits + 2^x Else wscript.echo "The Drive letter '"&UCase(substr)&"' not exsits!Try again!" exitcode = 1ExitForEndIfElse wscript.echo "Something dupilcate,please try again" exitcode = 1EndIfEndIf x = x + 1NextIf exitcode = 1ThenExitForEndIfNext
Windows 7 or higher version
Additional Resources
Related forum threads: