Zh: 有时候, 硬盘有 unallocated 分区,而且 unallocated 分区前面是恢复分区,这样我们无法扩展系统分区,这时,我们需要先移动恢复分区到最后面。
En: Sometimes, the hard disk has an unallocated partition, and the recovery partition is in front of the unallocated partition, so we cannot extend the OS partition. In this case, we need to move the recovery partition to the back first.
Download moverecoverypartition.zip @echo == MoveRecoveryPartition-BIOS ==
@rem *********************************************************************
@echo ********************************************************************
@echo 本程序只适用于这种分区: 第1个硬盘 (disk 0),分区1: 系统预留, 分区2: 系统分区, 分区3:恢复分区, 分区4:未分配分区,如果你的分区情况不一样,请自行更改。
@echo 本程序在同一个操作系统内只能运行一次! 如果运行两次以上,可能会造成 Recovery Partition 不可用,此时需要手动修复。
@echo This program is only applicable to this kind of partition: The first hard disk (disk 0), Partition 1: System reserved Partition, Partition 2: OS Partition, Partition 3: Recovery partition, Partition 4: Unallocated partition, if your partition situation is different, please change it by yourself.
@echo This program can only be run once in the same operating system! If you run it more than twice, the Recovery Partition may be unavailable, and it needs to be fix manually.
@echo ********************************************************************
pause
@echo == Open the Recovery partition ==
diskpart /s OpenRecoveryPartitions-BIOS.txt
@echo ********************************************************************
@echo == Backup Recovery partition ==
Dism /Capture-Image /ImageFile:C:\Users\Administrator\Downloads\recovery-partition.wim /CaptureDir:O:\ /Name:"Recovery"
@echo ********************************************************************
@echo == Delete the Old Recovery partition and Create Recovery partition ==
diskpart /s CreateRecoveryPartitions-BIOS.txt
@echo ********************************************************************
@echo == Apply Recovery partition ==
Dism /Apply-Image /ImageFile:C:\Users\Administrator\Downloads\recovery-partition.wim /Index:1 /ApplyDir:R:\
@echo *******************************************************************
@echo == Register the location of the recovery tools ==
C:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target C:\Windows
C:\Windows\System32\Reagentc /enable /auditmode
@echo ********************************************************************
@echo == Hide Recovery partition ==
diskpart /s HideRecoveryPartitions-BIOS.txt
@echo *******************************************************************
@echo == Verify the configuration status of the images. ==
C:\Windows\System32\Reagentc /Info /Target C:\Windows
@echo (Note: Windows RE status may appear as Disabled, this is OK.)
@echo ********************************************************************
@echo == Delete recovery-partition.wim ==
@rem DEL C:\Users\Administrator\Downloads\recovery-partition.wim
@echo *******************************************************************
@echo All done!
@echo Please check the partition after reboot.
@echo If you need help, please contact tim.
@echo *******************************************************************
start diskmgmt
pause
rem === OpenRecoveryPartitions-BIOS.txt ===
select disk 0
select partition 3
set id=07
assign letter="O"
list volume
exit
rem == CreateRecoveryPartitions-BIOS.txt ==
select volume="O"
remove letter="O" noerr
select disk 0
rem == delete Recovery partition first
select partition 3
delete partition override
rem == Extend the Windows partition ==
select disk 0
select partition 2
extend
rem == Create space for the recovery tools
shrink minimum=750
rem == Prepare the recovery partition ==
select disk 0
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R"
rem ** set id=27
list volume
exit
rem === HideRecoveryPartitions-BIOS.txt ===
select disk 0
select volume="R"
remove letter="R" noerr
select disk 0
select partition 3
set id=27
list volume
exit
@echo == MoveRecoveryPartition-UEFI ==
@rem *********************************************************************
@echo ********************************************************************
@echo This program is only applicable to this kind of partition: The first hard disk (disk 0), Partition 1: EFI Partition, Partition 2: System reserved Partition, Partition 3: OS Partition, Partition 4: Recovery partition, Partition 5: Unallocated partition, if your partition situation is different, please change it by yourself.
@echo This program can only be run once in the same operating system! If you run it more than twice, the Recovery Partition may be unavailable, and it needs to be fix manually.
@echo 本程序只适用于这种分区: 第1个硬盘 (disk 0),分区1:EFI, 分区2: 系统预留, 分区3: 系统分区, 分区4:恢复分区, 分区5:未分配分区,如果你的分区情况不一样,请自行更改。
@echo 本程序在同一个操作系统内只能运行一次! 如果运行两次以上,可能会造成 Recovery Partition 不可用,此时需要手动修复.
@echo ********************************************************************
pause
@echo == Open the Recovery partition ==
diskpart /s OpenRecoveryPartitions-UEFI.txt
@echo ********************************************************************
@echo == Backup Recovery partition ==
Dism /Capture-Image /ImageFile:C:\Users\Administrator\Downloads\recovery-partition.wim /CaptureDir:O:\ /Name:"Recovery"
@echo ********************************************************************
@echo == Delete the Old Recovery partition and Create Recovery partition ==
diskpart /s CreateRecoveryPartitions-UEFI.txt
@echo ********************************************************************
@echo == Apply Recovery partition ==
Dism /Apply-Image /ImageFile:C:\Users\Administrator\Downloads\recovery-partition.wim /Index:1 /ApplyDir:R:\
@echo *******************************************************************
@echo == Register the location of the recovery tools ==
C:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target C:\Windows
C:\Windows\System32\Reagentc /enable /auditmode
@echo ********************************************************************
@echo == Hide Recovery partition ==
diskpart /s HideRecoveryPartitions-UEFI.txt
@echo *******************************************************************
@echo == Verify the configuration status of the images. ==
C:\Windows\System32\Reagentc /Info /Target C:\Windows
@echo (Note: Windows RE status may appear as Disabled, this is OK.)
@echo ********************************************************************
@echo == Delete recovery-partition.wim ==
@rem DEL C:\Users\Administrator\Downloads\recovery-partition.wim
@echo *******************************************************************
@echo All done!
@echo Please check the partition after reboot.
@echo If you need help, please contact tim.
@echo *******************************************************************
start diskmgmt
pause
rem === OpenRecoveryPartitions-UEFI.txt ===
select disk 0
select partition 4
assign letter="O"
list volume
exit
rem == CreateRecoveryPartitions-UEFI.txt ==
select volume="O"
remove letter="O" noerr
select disk 0
rem == delete Recovery partition first
select partition 4
delete partition override
rem == Extend the Windows partition
select partition 3
rem ** assign letter="W"
extend
rem == Create space for the recovery tools
shrink minimum=750
rem == Create recovery partition
select disk 0
create partition primary
format quick fs=ntfs label="Recovery"
assign letter="R"
rem ** set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
rem ** gpt attributes=0x8000000000000001
list volume
exit
本文作者是一位开源理念的坚定支持者,所以本文内容遵照开源的精神发布。
无担保:本文作者不保证此文内容准确无误,亦不承担任何由于使用此文档所导致的损失。
自由使用:任何人都可以自由的阅读/链接/打印此文档,无需任何附加条件。
名誉权:任何人都可以自由的转载/引用/再创作此文档,但必须保留作者署名并注明出处。
其他作品
本文作者十分愿意与他人分享劳动成果,如果你对我的其他作品有兴趣,可以在如下位置查看现有的作品集:
Tim 作品集 [ https://tiimmm.com/ ]
联系方式
由于作者水平有限,因此不能保证此文内容准确无误。如果你发现了此文中的错误(哪怕是错别字也好),请来信指出,任何提高此文质量的建议我都将虚心接纳。
Email: tiimmm dot chen at gmail dot com
网站制作者:Author:tiimmm dot chen at gmail dot com, Welcome to email for discussion!