Skip to content

Instantly share code, notes, and snippets.

@BoQsc
Last active February 20, 2023 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoQsc/7d8f60b10aaa71fdcec689bbb486a7f4 to your computer and use it in GitHub Desktop.
Save BoQsc/7d8f60b10aaa71fdcec689bbb486a7f4 to your computer and use it in GitHub Desktop.
Format USB and install Linux ISO on Windows 10 automated way
@ECHO OFF
:wait_for_usb
TITLE Waiting for USB
FOR /f %%D IN ('wmic LogicalDisk get Caption^, VolumeName ^| find "LINUXUSB"') DO SET "DRIVE=%%D"
IF "%DRIVE%"=="" TIMEOUT /T 2 && CLS && GOTO :wait_for_usb
TITLE Formatting USB
ECHO select volume %DRIVE% > "%TEMP%/diskpartlinuxformat.txt"
ECHO clean >> "%TEMP%/diskpartlinuxformat.txt"
ECHO create partition primary >> "%TEMP%/diskpartlinuxformat.txt"
ECHO select partition 1 >> "%TEMP%/diskpartlinuxformat.txt"
ECHO format FS=fat32 label=LINUXUSB quick >> "%TEMP%/diskpartlinuxformat.txt"
DISKPART /S "%TEMP%/diskpartlinuxformat.txt"
TITLE Writing to USB
tar xfv "./linuxmint-21.1-xfce-64bit.iso" -C "%DRIVE%/"
TITLE Linux got installed on your USB DRIVE!
ECHO EVERYTHING IS DONE!
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment