Skip to content

Instantly share code, notes, and snippets.

@bcdejp
Created January 19, 2021 04:31
Show Gist options
  • Save bcdejp/82981f50fc0cfebf79034492c3e4ad04 to your computer and use it in GitHub Desktop.
Save bcdejp/82981f50fc0cfebf79034492c3e4ad04 to your computer and use it in GitHub Desktop.
# SDカードに規定のパーティションを作製する
$partitionStyle = "MBR";
$partitionSize1 = 1073741824;
$driveLetter1 = "J"
$driveLetter2 = "K";
$driveLetter3 = "L";
$driveLetter4 = "M";
$driveLetter5 = "N";
Get-Disk;
$diskNumber=Read-Host "フォーマットするディスク番号を入力してください"
Get-Disk | where Number -match $diskNumber | Clear-Disk -RemoveData -RemoveOEM -PassThru;
Get-Disk | where Number -match $diskNumber | New-Partition -MbrType FAT32 -Size $partitionSize1 -DriveLetter $driveLetter1 | Format-Volume -FileSystem FAT32 -NewFileSystemLabel A;
Get-Disk | where Number -match $diskNumber | New-Partition -MbrType FAT32 -Size $partitionSize1 -DriveLetter $driveLetter2 | Format-Volume -FileSystem FAT32 -NewFileSystemLabel B;
Get-Disk | where Number -match $diskNumber | New-Partition -MbrType Extended -UseMaximumSize;
Get-Disk | where Number -match $diskNumber | New-Partition -MbrType FAT32 -Size $partitionSize1 -DriveLetter $driveLetter3 | Format-Volume -FileSystem FAT32 -NewFileSystemLabel C-1;
Get-Disk | where Number -match $diskNumber | New-Partition -MbrType FAT32 -Size $partitionSize1 -DriveLetter $driveLetter4 | Format-Volume -FileSystem FAT32 -NewFileSystemLabel C-2;
Get-Disk | where Number -match $diskNumber | New-Partition -MbrType FAT32 -UseMaximumSize -DriveLetter $driveLetter5 | Format-Volume -FileSystem FAT32 -NewFileSystemLabel C-3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment