Skip to content

Instantly share code, notes, and snippets.

@tmsperera
Last active May 21, 2023 08:33
Show Gist options
  • Save tmsperera/d801acba5a0a9caffaccd27bcb5d79da to your computer and use it in GitHub Desktop.
Save tmsperera/d801acba5a0a9caffaccd27bcb5d79da to your computer and use it in GitHub Desktop.
#!/bin/bash
# see: https://www.freecodecamp.org/news/how-make-a-windows-10-usb-using-your-mac-build-a-bootable-iso-from-your-macs-terminal/
diskutil list
read -p "Enter the mounted iso name? (e.g. CCCOMA_X64FRE_EN-US_DV9) " -r MOUNTED_WINDOWS_VOLUME
read -p "Which disk do you want to be bootable? (e.g. /dev/diskX) " -r DISK
NEW_VOLUME="WINDOWS"
diskutil eraseDisk MS-DOS ${NEW_VOLUME} GPT ${DISK}
rsync -vha --exclude=sources/install.wim /Volumes/${MOUNTED_WINDOWS_VOLUME}/* /Volumes/${NEW_VOLUME}
wimlib-imagex split /Volumes/${MOUNTED_WINDOWS_VOLUME}/sources/install.wim /Volumes/${NEW_VOLUME}/sources/install.swm 3800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment