Skip to content

Instantly share code, notes, and snippets.

@oaeide
Last active May 9, 2023 12:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oaeide/978f2f04e2a85cfecac2 to your computer and use it in GitHub Desktop.
Save oaeide/978f2f04e2a85cfecac2 to your computer and use it in GitHub Desktop.
Script for mounting and unmounting VHD files in windows via send to menu
@ECHO OFF
TITLE Mount VHD
SETLOCAL
SET DiskPartScript="%TEMP%DiskpartScript.txt"
ECHO SELECT VDISK FILE="%~1" > %DiskPartScript%
ECHO ATTACH VDISK >> %DiskPartScript%
DiskPart /s %DiskPartScript%
ENDLOCAL
@ECHO OFF
TITLE Unmount VHD
SETLOCAL
SET DiskPartScript="%TEMP%DiskpartScript.txt"
ECHO SELECT VDISK FILE="%~1" > %DiskPartScript%
ECHO DETACH VDISK >> %DiskPartScript%
DiskPart /s %DiskPartScript%
ENDLOCAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment