当前位置:网站首页>Managing VHDS using batch
Managing VHDS using batch
2022-06-11 05:45:00 【zhmhbest】
VHD Script
List of articles
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 threading tutorial (XXIV) cas+volatile
- What is a thread pool?
- Use com youth. banner. Solution to the inflateexception reported by the banner plug-in
- Multi threading tutorial (XXIV) cas+volatile
- If the MAC fails to connect with MySQL, it will start and report an error
- 数据接入平台方案实现(游族网络)
- [元数据]LinkedIn-DataHub
- Why is the smart door lock so popular? What about the smart door locks of MI family and zhiting?
- 【项目篇- 附件佐证材料放什么?(十八种两千字总结)】创新创业竞赛项目计划书、挑战杯创业计划竞赛佐证材料
- Multithreading tutorial (XXI) double checked locking problem
猜你喜欢

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

NDK learning notes (VII) system configuration, users and groups

数据接入平台方案实现(游族网络)

Cocoapods installation error

Multithreading tutorial (XXVII) CPU cache and pseudo sharing

安装Oracle数据库

NDK learning notes (IX) POSIX sockect connection oriented communication

Implementation of data access platform scheme (Youzu network)

如何让灯具智能化,单火、零火智能开关怎么选!

WinForm (I) introduction to WinForm and use of basic controls
随机推荐
ELK日志系统实战(六):技术选型之vector与filebeat对比
Wechat applet learning record
数组部分方法
我们真的需要会议耳机吗?
Use of vlayout
Combing route - Compaction Technology
Wxparse parsing iframe playing video
Utiliser le fichier Batch Enum
More than 20 cloud collaboration functions, 3 minutes to talk through the enterprise's data security experience
Jsonobject jsonarray for parsing
Create cool collectionviewcell conversion animation
袋鼠云数栈基于CBO在Spark SQL优化上的探索
Swap numbers (no temporary variables)
创建酷炫的 CollectionViewCell 转换动画
[go deep into kotlin] - get to know flow for the first time
49. grouping of acronyms
Preliminary understanding of multi task learning
使用Batch读取注册表
【深入kotlin】 - Flow 进阶
NDK learning notes (VII) system configuration, users and groups