- 积分
- 140
- 最后登录
- 2023-12-2
- 精华
- 0
- 阅读权限
- 20
- 主题
- 35
- UID
- 454501
- 帖子
- 276
- PB币
- 4298
- 威望
- 5
- 贡献
- 0
- 技术
- 7
- 活跃
- 911
- UID
- 454501
- 帖子
- 276
- PB币
- 4298
- 贡献
- 0
- 技术
- 7
- 活跃
- 911
|
如果你的PC是GPT分区,必须采用UEFI引导安装系统。如果系统镜像中的install.wim大于4GB,比如目前最新的Windows 10 1703 update july 2017,文件大小4.71GB,还有Windows Server 2016 5.75GB,用普通的制作工具如UltraISO等就不支持了,因为UEFI分区只能是FAT32格式,而FAT32格式只支持小于4GB的文件。
前段时间看到国外大神的Power Shell脚本创建U盘UEFI引导,特拿来分享,希望能够帮助到需要的小伙伴
其中#为注释字段。红色标记的为自己的镜像路径,根据自己的实际情况更改。一定要以管理员身份运行Power shell。
# minimum size of USB stick 5.29GB
# Set here the path of your ISO file
$iso = 'E:\cn_windows_10_enterprise_version_1703_updated_june_2017_x64_dvd_10720588.iso'
# Clean ! will clear any plugged-in USB stick!!
Get-Disk | Where BusType -eq 'USB' |
Clear-Disk -RemoveData -Confirm:$true -PassThru
# Convert GPT
if ((Get-Disk | Where BusType -eq 'USB').PartitionStyle -eq 'RAW') {
Get-Disk | Where BusType -eq 'USB' |
Initialize-Disk -PartitionStyle GPT
} else {
Get-Disk | Where BusType -eq 'USB' |
Set-Disk -PartitionStyle GPT
}
# Create partition primary and format to FAT32
$volume = Get-Disk | Where BusType -eq 'USB' |
New-Partition -UseMaximumSize -AssignDriveLetter |
Format-Volume -FileSystem FAT32
if (Test-Path -Path "$($volume.DriveLetter):\") {
# Mount iso
$miso = Mount-DiskImage -ImagePath $iso -StorageType ISO -PassThru
# Driver letter
$dl = ($miso | Get-Volume).DriveLetter
}
if (Test-Path -Path "$($dl):\sources\install.wim") {
# Copy ISO content to USB except install.wim
& (Get-Command "$($env:systemroot)\system32\robocopy.exe") @(
"$($dl):\",
"$($volume.DriveLetter):\"
,'/S','/R:0','/Z','/XF','install.wim','/NP'
)
# Split install.wim
& (Get-Command "$($env:systemroot)\system32\dism.exe") @(
'/split-image',
"/imagefile:$($dl):\sources\install.wim",
"/SWMFile:$($volume.DriveLetter):\sources\install.swm",
'/FileSize:4096'
)
}
# Eject USB
(New-Object -comObject Shell.Application).NameSpace(17).
ParseName("$($volume.DriveLetter):").InvokeVerb('Eject')
# Dismount ISO
Dismount-DiskImage -ImagePath $iso
|
-
1
查看全部评分
-
|