This article mainly introduced the Win7 under the VHD file right key enhancement realization method, needs the friend may refer to under
1, save the following code to: C:windowssystem32vdm.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.app Lication "). 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
di M Objshell, objexec
set objshell = WScript.CreateObject ("Wscript.Shell")
set objexec = objShell.Exec ("C:windowssystem32diskpart.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_MACHINESOFTWAREClassesVirtual.Machine.HDShell]
@= "None"
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDShellDismount]
@= "Detach VHD (&d)"
[Hkey_local_ MACHINESOFTWAREClassesVirtual.Machine.HDShellDismountcommand]
@= "" C:windowssystem32wscript.exe "C: windowssystem32vdm.vbs/d "%1" "
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDShellMount]
@=" Mounts the VHD ( &M) "
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDShellMountcommand]
@=" "C: Windowssystem32wscript.exe "c:windowssystem32vdm.vbs/m" "%1" "
[Hkey_classes_root.vhd]
@=" Virtual.Machine.HD "