Diskpart in one bat file

前端 未结 1 1989
借酒劲吻你
借酒劲吻你 2021-01-26 04:57

I am trying to create a one bat file with diskpart script to automatize process of creating volumes. The problem is that I want to pass parameters like this:

dis         


        
相关标签:
1条回答
  • 2021-01-26 05:42

    Accordingly to the documentation given at this site, this should work:

    @echo off
    (
    echo select disk 0
    echo create volume simple size=%1
    echo format quick fs=ntfs label="userTest"
    echo assign letter="T"
    ) > script.txt
    diskpart /s script.txt
    

    Copy this code into a Batch file, for example createVolume.bat, and then use it this way:

    createVolume 500
    
    0 讨论(0)
提交回复
热议问题