Status Monitoring – Statusbar

How to have one line updated, for example showing available disk space updated every second.

Within one line:

while true; do echo -ne “$(df | grep /dev/sda4)\\r”; sleep 1; done

how it works:

while true: start of endless loop

  • echo:
    • -n: prevents line warp after outputting
    • -e: allows backslash escape keys
    • $(command): Runs the command and inserts the output
    • \\r: the first backslash escapes the second, and \r stands for jumping to the beginning of the line
  • sleep 1: pause for one second

done: end of endless loop

 

Within a script, you can write it into multiple lines:

while true
do
     echo -ne “$(df | grep /dev/sda4)\\r”
     sleep 1
done

SFC is deprecated, use dism instead

Often sfc.exe reports errors that could not be resolved.

Instead of “sfc.exe /scannow” run the following as Administrator:

Dism /Online /Cleanup-Image /ScanHealth

Dism /Online /Cleanup-Image /CheckHealth

this will report healthy, repairable or non-repairable. If it reports repairable run the following:

Dism /Online /Cleanup-Image /RestoreHealth

 

For offline Images:

Dism /Image:C:\offline /Cleanup-Image /RestoreHealth

 

 

Note:

The needed files are pulled dynamically from Windows Update so you need to have Internet access.