|
- @echo off
- :: 指定VHD挂载盘符
- set vhd_drive=z
- :: 指定挂载VHD文件
- set vhd_file=C:\Win.vhdx
- :: 建立DISKPART指令集
- echo sel vdisk file="%vhd_file%">>".\attach.txt"
- echo attach vdisk>>".\attach.txt"
- echo assign letter=%vhd_drive%>>".\attach.txt"
- goto :attach
- del /q /s ".\attach.txt""
- goto :eof
- :: 执行挂载
- :attach
- if not exist %vhd_drive%\nul diskpart /s ".\attach.txt"&&goto :attach
- goto :eof
复制代码 |
|