Create a Windows Bootable USB on macOS

诶…… 🤣

diskutil list to identify the USB drive

Erase and format main disk partition as FAT32

Create and format EFI partition as FAT32

Copy Windows ISO files to main partition

Copy EFI files from ISO to EFI partition

Unmount EFI partition

Mount EFI partition

Bless EFI partition folder

Eject USB drive

Copy
diskutil list

Identify the USB drive you want to use. eg. disk4

sudo diskutil eraseDisk FAT32 "winx" /dev/disk4

sudo newfs_msdos -F 32 -v "EFI" /dev/disk4s1

diskutil eraseVolume FAT32 "EFI" /dev/disk4s1

Copy the Windows ISO files to the USB drive

Copy EFI files from ISO to EFI partition

sudo diskutil unmount /dev/disk4s1

mkdir /private/tmp/efi
sudo mount -t msdos /dev/disk4s1 /private/tmp/efi

sudo bless --folder /private/tmp/efi

diskutil eject /dev/disk4