Also I'd suggest: (1) a /RW option to mount VHDs in read/write mode (ignore for .ISOs), and (2) allow more than one mount point to be specified (again, useful only for VHD files.)
I've done it manually using DiskPart.exe.
First, SELECT the VDISK:
SELECT file="C:\Program Files\Windows XP Mode\Windows XP Mode base.vhd"
Then ATTACH it :
ATTACH VDISK
You can also create VDISK's based on another VDISK using the CREATE command.
I've done it manually using DiskPart.exe.
First, SELECT the VDISK:
SELECT file="C:\Program Files\Windows XP Mode\Windows XP Mode base.vhd"
Then ATTACH it :
ATTACH VDISK
You can also create VDISK's based on another VDISK using the CREATE command.
Here's the .CMD files that I have been using in TCC to Mount/Unmount VHDs;
Code:
REM https://gist.github.com/nicjansma/9b82f28a77f306b0cfc0
@echo off
setlocal enabledelayedexpansion
if {%1}=={} (
echo Usage: %~nx0 [vhd] [letter]
exit /b 1
)
set vhdPath=%~dpnx1
set driveLetter=%2
if {!driveLetter!}=={} (
echo Mounting !vhdPath!
) else (
echo Mounting !vhdPath! to !driveLetter!:
)
REM
REM create dispart script
REM
set diskPartScript=%~nx0.diskpart
echo sel vdisk file="!vhdPath!">!diskPartScript!
echo attach vdisk>>!diskPartScript!
REM assign the drive letter if requested
if not {!driveLetter!}=={} (
echo select partition 1 >>!diskPartScript!
echo assign letter=!driveLetter!>>!diskPartScript!
)
REM Show script
echo.
echo Running diskpart script:
type !diskPartScript!
REM
REM diskpart
REM
diskpart /s !diskPartScript!
del /q !diskPartScript!
echo Done!
endlocal
Code:
REM https://gist.github.com/nicjansma/9b82f28a77f306b0cfc0
@echo off
setlocal enabledelayedexpansion
if {%1}=={} (
echo Usage: %~nx0 [vhd]
exit /b 1
)
set vhdPath=%~dpnx1
echo Unmounting !vhdPath!
REM
REM create dispart script
REM
set diskPartScript=%~nx0.diskpart
echo sel vdisk file="!vhdPath!">!diskPartScript!
echo detach vdisk>>!diskPartScript!
REM
REM diskpart
REM
diskpart /s !diskPartScript!
del /q !diskPartScript!
echo Done!
endlocal
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.