Created
May 13, 2016 15:10
-
-
Save herry13/bda2dc4d10cdbc34e938f17b40e700ac to your computer and use it in GitHub Desktop.
Create a bootable USB pen drive of Windows OS ISO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # create a GPT partition table and a FAT32 partition | |
| sudo sgdisk --zap-all /dev/sdb | |
| sudo sgdisk --new=1:0:0 --typecode=1:ef00 /dev/sdb | |
| sudo mkfs.vfat -F32 -n GRUB2EFI /dev/sdb1 | |
| # mount the partition | |
| sudo mount -t vfat /dev/sdb1 /mnt -o uid=1000,gid=1000,umask=022 | |
| # install GRUB2 | |
| sudo grub-install --removable --boot-directory=/mnt/boot --efi-directory=/mnt/EFI/BOOT /dev/sdb | |
| # mount Windows ISO | |
| mount -o loop windows.iso /media/cdrom | |
| # copy all Windows installation files | |
| cp -r /media/cdrom/* /mnt | |
| # umount the partition | |
| umount /mnt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment