**Need help with Diskpart in batch file to make USB bootable
Posted: 21 Sep 2009 16:59
Hi Guys,
I have created the below .cmd file to format my USB flash drive but now
I want to add additional script to make it bootable any ideas ?
I know i can use DiskPart with a text file to do it manually but I would rather
have it in a all-in-one script..
This is what I have so far...
@ECHO OFF
cls && Color 1E
Echo Geeks Computer Services August 2009. All rights reserved.
echo.
echo.
echo +=================================================+
echo + This file will Reformat your USB flash drive! +
echo +=================================================+
:start
echo.
echo Enter your USB flash drive letter (D,E,F,G,H,I,J,K,L,M,N) then press Enter
set /p drive=
if ‘%drive%’ == ‘D’ goto proceed
if ‘%drive%’ == ‘E’ goto proceed
if ‘%drive%’ == ‘F’ goto proceed
if ‘%drive%’ == ‘G’ goto proceed
if ‘%drive%’ == ‘H’ goto proceed
if ‘%drive%’ == ‘I’ goto proceed
if ‘%drive%’ == ‘J’ goto proceed
if ‘%drive%’ == ‘K’ goto proceed
if ‘%drive%’ == ‘d’ goto proceed
if ‘%drive%’ == ‘e’ goto proceed
if ‘%drive%’ == ‘f’ goto proceed
if ‘%drive%’ == ‘g’ goto proceed
if ‘%drive%’ == ‘h’ goto proceed
if ‘%drive%’ == ‘i’ goto proceed
if ‘%drive%’ == ‘j’ goto proceed
if ‘%drive%’ == ‘k’ goto proceed
if ‘%drive%’ == ‘l’ goto proceed
if ‘%drive%’ == ‘m’ goto proceed
if ‘%drive%’ == ‘n’ goto proceed
cls
goto error
:error
echo.
echo The drive letter you entered was not recognized
echo.
pause
cls
goto start
:proceed
cls
echo.
echo Would you like to format flash drive %drive%:?
echo.
echo Type Y for Yes or N for NO then press Enter
set /p ok=
if ‘%ok%’ == ‘y’ goto yes
if ‘%ok%’ == ‘Y’ goto yes
if ‘%ok%’ == ‘n’ goto no
if ‘%ok%’ == ‘N’ goto no
cls
:yes
cls
echo Pre-Stage Format:
echo First, let's ensure that the flash drive is inserted
echo.
format %drive%: /FS:fat32 /Q
END
I have created the below .cmd file to format my USB flash drive but now
I want to add additional script to make it bootable any ideas ?
I know i can use DiskPart with a text file to do it manually but I would rather
have it in a all-in-one script..
This is what I have so far...
@ECHO OFF
cls && Color 1E
Echo Geeks Computer Services August 2009. All rights reserved.
echo.
echo.
echo +=================================================+
echo + This file will Reformat your USB flash drive! +
echo +=================================================+
:start
echo.
echo Enter your USB flash drive letter (D,E,F,G,H,I,J,K,L,M,N) then press Enter
set /p drive=
if ‘%drive%’ == ‘D’ goto proceed
if ‘%drive%’ == ‘E’ goto proceed
if ‘%drive%’ == ‘F’ goto proceed
if ‘%drive%’ == ‘G’ goto proceed
if ‘%drive%’ == ‘H’ goto proceed
if ‘%drive%’ == ‘I’ goto proceed
if ‘%drive%’ == ‘J’ goto proceed
if ‘%drive%’ == ‘K’ goto proceed
if ‘%drive%’ == ‘d’ goto proceed
if ‘%drive%’ == ‘e’ goto proceed
if ‘%drive%’ == ‘f’ goto proceed
if ‘%drive%’ == ‘g’ goto proceed
if ‘%drive%’ == ‘h’ goto proceed
if ‘%drive%’ == ‘i’ goto proceed
if ‘%drive%’ == ‘j’ goto proceed
if ‘%drive%’ == ‘k’ goto proceed
if ‘%drive%’ == ‘l’ goto proceed
if ‘%drive%’ == ‘m’ goto proceed
if ‘%drive%’ == ‘n’ goto proceed
cls
goto error
:error
echo.
echo The drive letter you entered was not recognized
echo.
pause
cls
goto start
:proceed
cls
echo.
echo Would you like to format flash drive %drive%:?
echo.
echo Type Y for Yes or N for NO then press Enter
set /p ok=
if ‘%ok%’ == ‘y’ goto yes
if ‘%ok%’ == ‘Y’ goto yes
if ‘%ok%’ == ‘n’ goto no
if ‘%ok%’ == ‘N’ goto no
cls
:yes
cls
echo Pre-Stage Format:
echo First, let's ensure that the flash drive is inserted
echo.
format %drive%: /FS:fat32 /Q
END