当前位置:网站首页>使用Batch管理VHD
使用Batch管理VHD
2022-06-11 05:38:00 【zhmhbest】
VHD Script
Create
@echo off
set VHD_File=E:\Temp\test.vhd
set VHD_Label=Temp
set VHD_Size=100
REM size = ?m
set VHD_Type=expandable
REM type = fixed | expandable
REM ================
if exist "%VHD_File%" exit
set VHD_Script=%Temp%\VHD_Script%Random%
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [create]
echo create vdisk file="%VHD_File%" maximum=%VHD_Size% type=%VHD_Type% > "%VHD_Script%"
echo select vdisk file="%VHD_File%" >> "%VHD_Script%"
echo attach vdisk >> "%VHD_Script%"
echo create partition primary >> "%VHD_Script%"
echo active >> "%VHD_Script%"
echo format fs=ntfs quick label="%VHD_Label%" >> "%VHD_Script%"
echo detach vdisk >> "%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
Attach & Mount
@echo off
set VHD_File=E:\Temp\test.vhd
set VHD_Path=I:
REM ================
if not exist "%VHD_File%" exit
set VHD_Script=%Temp%\VHD_Script%Random%
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [attach]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo attach vdisk >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
ping -n 2 127.0.0.1>nul
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [mount]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo select partition=1 >>"%VHD_Script%"
echo assign mount="%VHD_Path%" >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
Remove & Detach
@echo off
set VHD_File=E:\Temp\test.vhd
REM ================
if not exist "%VHD_File%" exit
set VHD_Script=%Temp%\VHD_Script%Random%
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [remove]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo select partition=1 >>"%VHD_Script%"
echo remove >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
ping -n 2 127.0.0.1>nul
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [detach]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo detach vdisk >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
Remount
@echo off
set VHD_File=E:\Temp\test.vhd
set VHD_Path=H:
REM ================
if not exist "%VHD_File%" exit
set VHD_Script=%Temp%\VHD_Script%Random%
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [attach]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo attach vdisk >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
ping -n 2 127.0.0.1>nul
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [remove]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo select partition=1 >>"%VHD_Script%"
echo remove >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
ping -n 2 127.0.0.1>nul
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
echo [mount]
echo select vdisk file="%VHD_File%" >"%VHD_Script%"
echo select partition=1 >>"%VHD_Script%"
echo assign mount="%VHD_Path%" >>"%VHD_Script%"
call diskpart /s "%VHD_Script%"
del "%VHD_Script%"
REM ■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■
边栏推荐
- Multi thread tutorial (30) meta sharing mode
- More than 20 cloud collaboration functions, 3 minutes to talk through the enterprise's data security experience
- If the MAC fails to connect with MySQL, it will start and report an error
- 微信小程序,购买商品属性自动换行,固定div个数,超出部分自动换行
- NDK learning notes (12) native graphics API, using avilib to create an avi video player
- NDK learning notes (VII) system configuration, users and groups
- 微信自定义组件---样式--插槽
- 智能门锁为什么会这么火,米家和智汀的智能门锁怎么样呢?
- Wechat applet learning record
- 数据接入平台方案实现(游族网络)
猜你喜欢
![[元数据]LinkedIn-DataHub](/img/6a/247ee77dfc219d26651e5d93b04c98.png)
[元数据]LinkedIn-DataHub

Analysis while experiment - a little optimization of memory leakage in kotlin

Maximum number of points on the line ----- hash table solution

NDK learning notes (14) create an avi video player using avilib+window

20多种云协作功能,3分钟聊透企业的数据安全经

NDK learning notes (IX) POSIX sockect connection oriented communication

Getbackgroundaudiomanager controls music playback (dynamic binding of class name)

Recherche sur l'optimisation de Spark SQL basée sur CBO pour kangourou Cloud Stack

Multithreading tutorial (XXI) double checked locking problem

微信小程序text内置组件换行符不换行的原因-wxs处理换行符,正则加段首空格
随机推荐
Feynman learning method
Redis setup (sentinel mode)
1.使用阿里云对象OSS(初级)
SwiftUI: Navigation all know
Bit operation marks multiple switches with one parameter
Manually splicing dynamic JSON strings
Multi thread tutorial (30) meta sharing mode
MySQL circulates multiple values foreach, XML writing method
Informatica:数据质量管理六步法
Opencv learning path (2-3) -- Deep parsing imshow function
【项目篇- 附件佐证材料放什么?(十八种两千字总结)】创新创业竞赛项目计划书、挑战杯创业计划竞赛佐证材料
Wechat custom component - style - slot
ImageView supporting single finger sliding and double finger scaling
Common methods of tool class objectutil
Create cool collectionviewcell conversion animation
Project - Smart City
使用Genymotion Scrapy控制手机
js promise,async,await简单笔记
NDK learning notes (12) native graphics API, using avilib to create an avi video player
Opencv learning path (2-2) -- Deep parsing namedwindow function