Solved Fat32formatter Scripting With Diskpart

Microsoft Windows server 2008 r2 enterpr...
August 5, 2014 at 07:57:26
Specs: Any, ANY
Good Afternoon All,

I have created a group of 3 script to automatically format multiple HDDs to fat32 regardless of the size using Fat32foramtter (command line version) and diskpart, please see below (all files are executed from the one folder):

Batch File 1 (Master Bat File)

DISKPART.EXE /S "BATCH_SCRIPT_DATA_1.TXT"
START /WAIT BATCH_SCRIPT_DATA_2.BAT
START /WAIT LABEL.BAT
EXIT


BATCH_SCRIPT_DATA_1.TXT

SELECT DISK 1
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=Z
ACTIVE
SELECT DISK 2
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=Y
ACTIVE
SELECT DISK 3
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=X
ACTIVE
SELECT DISK 4
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=W
ACTIVE
SELECT DISK 5
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=V
ACTIVE
SELECT DISK 6
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=U
ACTIVE
SELECT DISK 7
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=T
ACTIVE
SELECT DISK 8
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=S
ACTIVE
SELECT DISK 9
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=R
ACTIVE
SELECT DISK 10
CLEAN
CREATE PARTITION PRIMARY
ASSIGN LETTER=Q
ACTIVE
EXIT

BATCH_SCRIPT_DATA_2.BAT

echo y | fat32format Z:
echo y | fat32format X:
echo y | fat32format V:
echo y | fat32format U:
echo y | fat32format T:
echo y | fat32format S:
echo y | fat32format R:
echo y | fat32format Q:
EXIT

LABEL.BAT

LABEL Z: Disk_1
LABEL X: Disk_2
LABEL V: Disk_3
LABEL U: Disk_4
LABEL T: Disk_5
LABEL S: Disk_6
LABEL R: Disk_7
LABEL Q: Disk_7
EXIT

I just want someone to look over this script and advise me if I have it right or not or to advise me how to make it better.

Your help is much appreciated.

Kind Regards
Tor Fey



See More: Fat32formatter Scripting With Diskpart

Report •


#1
August 6, 2014 at 11:06:02
✔ Best Answer
Never used fat32format, so I assume it tests okay. You only format 8 drives and you partition 10 disks, so you're probably missing 2 volumes.

Never name your scripts after the program it's intended to run. You're liable to end up in an endless loop where the script keeps calling itself until you crash.

You probably should be using CALL over START /WAIT, especially if you intend to run this in a WinPE environment.

Really, you could just combine all three scripts into a single file and be better off for it.

I'd probably consolidate everything into a single file, and write it like this (completely untested):

setlocal enableDelayedExpansion
set cnt=0
for %%a in (Z Y X W V U T S R Q) do (
set /a cnt += 1
@(echo.SELECT DISK !cnt!
echo.CLEAN
echo.CREATE PARTITION PRIMARY
echo.ASSIGN LETTER=%%a
echo.ACTIVE
echo.EXIT) | diskpart
echo.y | fat32format %%a:
label %%a: Disk_!cnt!
)

How To Ask Questions The Smart Way


Report •

#2
August 8, 2014 at 00:48:01
Hi Razor,

Thanks for your help once again, I have made some changes to the script with your amendments; except the Fat32formatter utility; after speaking with it's creator, the only way to have it do it's job; is to have a separate script just for this purpose. The Fat32formatter utility command line used with this program are different from dos/cmd prompt; and due to the fact it has to run under an off network build of Win XP Pro (long Story).

Needless to say everything is all sorted now and everything seems to be working as expected.

Your help is once again appreciated.

Kind Regards
Tor Fey


Report •

Related Solutions


Ask Question