SoFunction
Updated on 2025-03-10

Right-click to enhance implementation code for VHD files under Win7 (vbs+registry)

1. Save the following code to: c:\windows\system32\

Copy the codeThe code is as follows:

Dim Args
Set Args =
TranArgs = " "
For i = 0 To - 1
 TranArgs = TranArgs & """" & Args(i) & """" & " "
Next

If Args(0) <> "-hFlag" Then
 If Args(0) <> "-hWind" Then
  CreateObject("").ShellExecute "", _
   """" & & """" & " -hWind" & TranArgs, "", "runas", 1
  (5)
 Else
  CreateObject("").Run " " & _
   """" & & """" & Replace(TranArgs, "-hWind", "-hFlag"), 0, TRUE
  (1)
 End If
Else
 'Add Your Codes
 Dim objShell, objExec
 Set objShell = ("")
 Set objExec = ("c:\windows\system32\")

  "select vdisk file=""" & (2) & """"

 Select Case Args(1)
  Case "/M"
    "attach vdisk"
    "exit"
   (0)

  Case "/D"
    "detach vdisk"
    "exit"
   (0)

  Case Else
   'other
   (0)
 End Select

 (0)
End If

2. Import the registry file:

Copy the codeThe code is as follows:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\\Shell]
@="none"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\\Shell\Dismount]
@="Separate VHD(&D)"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\\Shell\Dismount\command]
@="\"C:\\windows\\system32\\\" C:\\Windows\\System32\\ /D \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\\Shell\Mount]
@="mount VHD(&M)"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\\Shell\Mount\command]
@="\"C:\\windows\\system32\\\" C:\\Windows\\System32\\ /M \"%1\""
[HKEY_CLASSES_ROOT\.vhd]
@=""

File packaging and download:VHD right click enhancement