windowsbatch-file

How to write the output from diskpart to a file


I want to write the output from a diskpart command to a file, i.e., say something like

LIST PARTITION >c:\output.txt

How can I do this?


Solution

  • You can do this using the /s option to diskpart, i.e.,

    diskpart /s scriptfile.txt > output.txt
    

    where scriptfile.txt contains the command to be executed, i.e.,

    LIST PARTITION