Page 1 of 1

auto answering a FORMAT command

Posted: 30 Jul 2007 11:18
by Mark_B
I am currently writing a script that will auto partition a disk into volumes as part of the server installation.

I am using diskpart to create the volumes and assigning the appropriate drive letter, but i can not work out a way of stopping the FORMAT command from requiring user input to select Y on the "are you sure you wish to format" question.

the format command i am using is :

Code: Select all

format e: /fs:ntfs /q /v:MthEndData


and the diskpart creation command (just in case its needed) is :

Code: Select all

create volume simple size=50 disk=0
assign letter e


Any help you could give me would be greatly appreciated.

Regards

Mark

Posted: 30 Jul 2007 19:08
by DosItHelp
Mark_B,

You can try piping the user input into the format command via ECHO, i.e.:

Code: Select all

(echo.Y)|format e: /fs:ntfs /q /v:MthEndData

if there are more than one questions to answer then pipe more lines by using more than one ECHO command, i.e. for one YES and one NO answer use:

Code: Select all

(echo.Y&echo.N)|format e: /fs:ntfs /q /v:MthEndData

I let you try it it out :D
Let me know how it goes!