Skip to content

Instantly share code, notes, and snippets.

@cryptolok
Created June 12, 2018 22:03
Show Gist options
  • Save cryptolok/4321c415496e6d16bc5fd1d81ed3396c to your computer and use it in GitHub Desktop.
Save cryptolok/4321c415496e6d16bc5fd1d81ed3396c to your computer and use it in GitHub Desktop.
Linux BASH script to make bootable Windows USB ISO image
#!/bin/bash
# sudo !!
echo "
__
,-~¨^ ^¨-, _,
/ / ;^-._...,¨/
/ / / /
/ / / /
/ / / /
/,.-:''-,_ / / /
_,.-:--._ ^ ^:-._ __../
/^ / /¨:.._¨__.;
/ / / ^ /
/ / / /
/ / / /
/_,.--:^-._/ / /
^ ^¨¨-.___.:^
WIN ISO 2 BOOTABLE USB
"
if [ "$1" ] & [ "$2" ]
then
ISO=$1
# https://www.microsoft.com/software-download/windows10ISO
USB=$2
FAT="$USB"1
MNT=/mnt/USB
mkdir -p $MNT
TMP=/mnt/Image
mkdir -p $TMP
echo "Creating FAT32 bootable UEFI partition..."
echo -e 'o\nn\np\n1\n\n\nt\nc\na\nw' | fdisk $USB
mkfs.fat $FAT
echo "Copying files..."
mount $FAT $MNT
mount $ISO $TMP
cp -r $TMP/* $MNT
sync
umount $MNT
umount $TMP
echo "Done"
else
echo "Usage : win2usb.sh VMs/Win10_1803_English_x64.iso /dev/sdX"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment