Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell: Can we change Write-Progress UI?

Is it possible to change Write-Progress color scheme and other UI things, like progress bar?

Presently, its light green with a progress bar composed of "O"... And I want to change the color (or remove the color) and replace that "O" with something else.

like image 368
Farrukh Waheed Avatar asked Oct 10 '13 12:10

Farrukh Waheed


People also ask

How do you write a progress in PowerShell?

You can use the Write-Progress cmdlet to add a progress bar to any PowerShell script. Microsoft has provided a super simple script to show how this cmdlet works. The first line of the script sets up a loop. The loop starts with the $i variable set to 1 and each loop cycle increases the value of $i by 1 ($i++).

What is write-verbose?

The Write-Verbose cmdlet writes text to the verbose message stream in PowerShell. Typically, the verbose message stream is used to deliver more in depth information about command processing.

Do While loop in PowerShell?

The Do-While loop is a looping structure in which a condition is evaluated after executing the statements. This loop is also known as the exit-controlled loop. The do-while loop is the same as while loop, but the condition in a do-while loop is always checked after the execution of statements in a block.


1 Answers

You can change the foreground and background colors of the Write-Progress output by modifying the ProgressForegroundColor and ProgressBackgroundColor of the $host.privatedata ConsoleColorProxy object.

For example, if you really hate your eyes:

$host.privatedata.ProgressForegroundColor = "darkgreen";
$host.privatedata.ProgressBackgroundColor = "red";
like image 59
alroc Avatar answered Oct 09 '22 05:10

alroc