title: Command Prompt read system output
body: <p>Hi Stackoverflow Community,</p>
  
  <p>After many occasions of fixing computers using maintenance and integrity commands via command prompt manually I've decide I wanted to create a batch file doing the same techniques based upon command output. In terms of writing the batch file the only issue I'm struggling with it reading in data from command itself rather than text file. For example;</p>
  
  <p>If Chkdsk comes back saying there multiple bad sectors, using if clause or another syntax it will schedule a repair i.e chkdsk /r next restart etc etc. The picture below with red highlighted are sections in which I wanted to read in if possible.</p>
  
  <p><a href="https://i.stack.imgur.com/bXE0P.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bXE0P.jpg" alt="enter image description here"></a></p>
  
  <p>@echo off
  chkdsk
  /* If an issue been has found */
  chkdsk /f</p>