auto answering a FORMAT command

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Posts: 3
Joined: 12 Jul 2007 10:08

auto answering a FORMAT command

#1 Post by Mark_B » 30 Jul 2007 11:18

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.



Posts: 239
Joined: 18 Feb 2006 19:54

#2 Post by DosItHelp » 30 Jul 2007 19:08


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!

Post Reply