It shouldnt be in the text file.
the first line in partitions.txt should be select disk or sel dis whatever number for example
sel dis 0
you need to add a bit code to select the disk - here is a quick way, somebody might suggest something better but this does the job
Code:
@echo off
ECHO Lis Dis|DISKPART.EXE
echo. &echo.
:CHOOSEdiskno
ECHO.
echo PLEASE ENTER A DISK NUMBER
ECHO.
set selecteddiskno=
set /p selecteddiskno="Disk Number => "
ECHO.
if not defined selecteddiskno goto :CHOOSEdiskno
echo. &echo.
:CHECKdiskno
echo ARE YOU SURE YOU WANT TO PROCESS DISK %selecteddiskno%
SET YESNO=
SET /P YESNO="Y=YES / N=NO => "
echo.
IF /I NOT '%YESNO%'=='Y' IF /I NOT '%YESNO%'=='N' goto :CHECKdiskno
IF /I '%YESNO%'=='N' GOTO :CHOOSEdiskno
ECHO sel dis %selecteddiskno% >x:\partitions.txt
ECHO cle >>x:\partitions.txt
ECHO Convert GPT >>x:\partitions.txt
ECHO cre par efi size=260 >>x:\partitions.txt
ECHO for quick fs=fat32 label="System" >>x:\partitions.txt
ECHO ass letter="S" >>x:\partitions.txt
ECHO cre par msr size=16 >>x:\partitions.txt
rem and the rest of the partitioning commands
rem then tel diskpart to run the partitions.txt you just made
diskpart.exe /s x:\partitions.txt
****************************************************************************************************************************************************
If you dont understand what it is doing you can run this little batch file which will produce a textfile c:\test-partitions.txt.
You can then have a look at a c:\test-partition.txt afterwards
test.cmd
@echo off
ECHO sel dis 0 >c:\test-partitions.txt
ECHO lis par >>c:\test-partitions.txt
ECHO cle >>c:\test-partitions.txt
ECHO Convert GPT >>c:\test-partitions.txt
ECHO cre par efi size=260 >>c:\test-partitions.txt
ECHO for quick fs=fat32 label="System" >>c:\test-partitions.txt
ECHO ass letter="S" >>c:\test-partitions.txt
ECHO cre par msr size=16 >>c:\test-partitions.txt
rem now have a look
notepad c:\test-partitions.txt
pause