i'm searching for a way to get windows command line output elements in variables. for example in diskpart
tool, when i enter list disk
, it lists disk items:
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 931 GB 0 B
Disk 1 Online 931 GB 0 B
but i want to get each item of output in a variable, in this case for example i want to store items disk 0
and disk 1
in two variables. i know this is done for whole output string to store it in a variable but i want the elements of output.
i want the elements to process in my c# program.
is there any way to achieve this goal?