locked
Diskpart Batch File RRS feed

  • Question

  • hi,

             how to create batch file for diskpart, plz help me

    Sunday, September 26, 2010 8:26 AM

Answers

  • Hi! As suggest Alex, please read the technet reference for more info.

    I see many people use a batch file with the diskpart command but it doesn't work that way.

    Here is an example for fomatting a drive:
    1. create a text file (diskpart.txt) with the following lines:

    SELECT DISK 0
    CLEAN
    CREATE PART PRI
    SELECT PART 1
    ACTIVE
    ASSIGN
    FORMAT FS=NTFS QUICK
    EXIT

    2. Now to automate the script. create a batch file (diskpart.cmd) and add the line below:

    DISKPART /s diskpart.txt

    This is the way to use diskpart with a batch file. it will read all the command from the text file.

    regards,


    Blog Microsoft | Déployer Windows 7 | Améliorer les performances de Windows 7
    • Marked as answer by Linda Yan Tuesday, September 28, 2010 7:12 AM
    Sunday, September 26, 2010 4:45 PM
  • I suggest you read this TechNet article:

    http://technet.microsoft.com/en-us/library/cc766465(WS.10).aspx

    what exactly do you want to do ?

    • Marked as answer by Linda Yan Tuesday, September 28, 2010 7:12 AM
    Sunday, September 26, 2010 10:49 AM

All replies

  • I suggest you read this TechNet article:

    http://technet.microsoft.com/en-us/library/cc766465(WS.10).aspx

    what exactly do you want to do ?

    • Marked as answer by Linda Yan Tuesday, September 28, 2010 7:12 AM
    Sunday, September 26, 2010 10:49 AM
  • Hi! As suggest Alex, please read the technet reference for more info.

    I see many people use a batch file with the diskpart command but it doesn't work that way.

    Here is an example for fomatting a drive:
    1. create a text file (diskpart.txt) with the following lines:

    SELECT DISK 0
    CLEAN
    CREATE PART PRI
    SELECT PART 1
    ACTIVE
    ASSIGN
    FORMAT FS=NTFS QUICK
    EXIT

    2. Now to automate the script. create a batch file (diskpart.cmd) and add the line below:

    DISKPART /s diskpart.txt

    This is the way to use diskpart with a batch file. it will read all the command from the text file.

    regards,


    Blog Microsoft | Déployer Windows 7 | Améliorer les performances de Windows 7
    • Marked as answer by Linda Yan Tuesday, September 28, 2010 7:12 AM
    Sunday, September 26, 2010 4:45 PM
  • Hello,
    I want to create a batch file that job follows. I have hard drive connected to a docking unit on my computer. This will be a batch file in the harddisk that file name is "ChangeDiskVolume.bat". When I double-click on the file that contains the file name, detect the disk volume, volume name. if appropriate R: volume, this batch must do it R:, else cancel the operation, giving an error message if it is not appropriate.

    This process can be done with a single batch file?

    Note: I used to google translate for this message. I apologize for mistakesI hope I explained my problem. :)

    Wednesday, September 7, 2011 2:59 PM
  • Follow below link to create automated batch file for diskpart commands:       

    http://answers-free.blogspot.in/2014/02/how-to-automate-windows-diskpart.html


    Sunday, February 23, 2014 7:50 PM
  • Follow below link to create automated batch file for diskpart commands:       

    http://answers-free.blogspot.in/2014/02/how-to-automate-windows-diskpart.html


    Sunday, February 23, 2014 7:52 PM