Different Color for Command vs Output?

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 16 years and 5 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
jeremyg
Posts: 23
Last visit: Mon Mar 18, 2024 6:07 am

Different Color for Command vs Output?

Post by jeremyg »

Hello. I'm trying to do something, that *should* be simple to do, but hell if I can make anything work.
What I want is for my prompt to show up in Color A....my typing/command to be in Color B, and the output of the command to be in Color C.
I can find no way to make this work. Any help?
User avatar
jeremyg
Posts: 23
Last visit: Mon Mar 18, 2024 6:07 am

Different Color for Command vs Output?

Post by jeremyg »

Hello. I'm trying to do something, that *should* be simple to do, but hell if I can make anything work.
What I want is for my prompt to show up in Color A....my typing/command to be in Color B, and the output of the command to be in Color C.
I can find no way to make this work. Any help?
User avatar
jeremyg
Posts: 23
Last visit: Mon Mar 18, 2024 6:07 am

Different Color for Command vs Output?

Post by jeremyg »

I'm actually using PowerShell plus. I've tried several methods of changing the output text. For the prompt function i've changed color using the write-host with -foreground color, and I've used $host.ui.RawUI.foreground color.

But no matter the combination I use, I cant seem to get the output color to be different from the input color. I just thought it would be super-efficient when scrolling up in the buffer to easily visually identify the command I typed compared to the output I product (especially since I'm still in learning mode)

Also, i'm a little disappointed that there seems to be no way to use RGB values when setting foreground color....only the preset constants. Is this true?

I had dreamed of writing a function that would display files with varying shades of grey based on criteria such as file size.
User avatar
jeremyg
Posts: 23
Last visit: Mon Mar 18, 2024 6:07 am

Different Color for Command vs Output?

Post by jeremyg »

Yea I know :)

However my goal with powershell is to not only script it, but to use it "live" to be a REALLY good admin, as was the case in the 90's when people who could work in DOS were miles above people who had to click through all the GUI's (i might even argue that they weren't REAL admins)

The idea is to make "scripts" that really act to provide real-time information.....to be seen by human eyes. I guess with the limitations that I'm going to have to output to HTML and then launch that HTML as part of the same script.
User avatar
jeremyg
Posts: 23
Last visit: Mon Mar 18, 2024 6:07 am

Different Color for Command vs Output?

Post by jeremyg »

Very interesting, I didn't know this existed in the v2 CTP. I suppose I have to migrate to using only the CTP in order to not limit myself....since by the time Powershell REALLY takes hold, v2 will be common place.

is it totally stable?
I think i'm going to stick to the out-GridView, since I dont like to rely on items that wont be "everywhere".

A quick question about the remoting. (since I havent read much about it) Am I correct in assuming that you can off-load processing tasks to remote systems and then return the data back to the local system?

For example, it is completely inefficient to generate MD5 hashes of files in remote locations for the purpose of comparison, because you'd have to read all contents of the file across the network. Can you use remoting to have the server generate MD5's of a file and return the value locally?
User avatar
jeremyg
Posts: 23
Last visit: Mon Mar 18, 2024 6:07 am

Different Color for Command vs Output?

Post by jeremyg »

Thanks for all your answers....now to find the free time....
This topic is 16 years and 5 days old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked