1, save the following code to: C:\windows\system32\vdm.vbs
Copy Code code as follows:
Dim Args
Set Args = wscript.arguments
Tranargs = ""
For i = 0 to Args.count-1
Tranargs = Tranargs & "" "& Args (i) &" "" & ""
Next
If Args (0) <> "-hflag" Then
if Args (0) <> "-hwind" Then
createobject (" Shell.Application "). ShellExecute "Wscript.exe", _
"" "& Wscript.scriptfullname &" "" & "-hwind" & Tra Nargs, "", "RunAs", 1
wscript.quit (5)
else
createobject ("Wscript.Shell"). Run "cscript.exe" & _
"" "& Wscript.scriptfullname &" "" & Replace (Tranargs, "-HW IND ","-hflag "), 0, TRUE
wscript.quit (1)
end If
Else
' Add Your codes
Dim Objshell, objexec
set objshell = WScript.CreateObject ("Wscript.Shell")
set objexec = Objshell.exec ("C:\windows\system32\diskpart.exe")
objexec.stdin.writeline "select Vdisk file=" " & WScript.Arguments (2) & ""
Select case Args (1)
Case "/M"
ObjExec.StdIn.WriteLine "Attach Vdisk"
ObjExec.StdIn.WriteLine "Exit"
Wscript.Quit (0)
Case "/d"
ObjExec.StdIn.WriteLine "Detach Vdisk"
ObjExec.StdIn.WriteLine "Exit"
Wscript.Quit (0)
Case Else
' Other
Wscript.Quit (0)
End Select
Wscript.Quit (0)
End If
2. Import registry files:
Copy Code code as follows:
Windows Registry Editor Version 5.00
[Hkey_local_machine\software\classes\virtual.machine.hd\shell]
@= "None"
[Hkey_local_machine\software\classes\virtual.machine.hd\shell\dismount]
@= "Detach VHD (&d)"
[Hkey_local_machine\software\classes\virtual.machine.hd\shell\dismount\command]
@= "\" c:\\windows\\system32\\wscript.exe\ "c:\\windows\\system32\\vdm.vbs/d \"%1\ ""
[Hkey_local_machine\software\classes\virtual.machine.hd\shell\mount]
@= "Mount VHD (&m)"
[Hkey_local_machine\software\classes\virtual.machine.hd\shell\mount\command]
@= "\" c:\\windows\\system32\\wscript.exe\ "c:\\windows\\system32\\vdm.vbs/m \"%1\ ""
[HKEY_CLASSES_ROOT\.VHD]
@= "Virtual.Machine.HD"
File Packaged Downloads: VHD Right-enhanced