![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #11 (permalink) |
| | Re: Translating colors to hex and back In message <F6562493-22E2-48D9-9893-057C85AB0F72@microsoft.com>, "/\\/\\o\\/\\/ [MVP]" <mow001@hotmail.NoSpam> writes >Ok, but ( curiosity killed the cat ) what is white ? > >PoSH> [enum]::GetNames([System.ConsoleColor]) |% {$_;"{0:x}" -f >([drawing.Color]$_).ToArgb()} Cool! So why does this fail: PSH [D:\foo]: $e="[enum]::GetNames([system.consolecolor])" PSH [D:\foo]: $e [enum]::GetNames([system.consolecolor]) PSH [D:\foo]: & $e The term '[enum]::GetNames([system.consolecolor])' is not recognized as a cmdlet, function, operable program, or script file. Ver ify the term and try again. At line:1 char:2 + & <<<< $e Whereas this works fine when typed from the commend line PSH [D:\foo]: [enum]::GetNames([system.consolecolor]) Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow Gray DarkGray Blue Green Cyan Red Magenta Yellow White PSH [D:\foo]: -- Thomas Lee doctordns@gmail.com MVP - Admin Frameworks and Security |
My System Specs![]() |
| | #12 (permalink) |
| | Re: Translating colors to hex and back "Thomas Lee" <tfl@psp.co.uk> wrote in message news:gnAUx3jgZY8FFAY$@mail.psp.co.uk... > In message <F6562493-22E2-48D9-9893-057C85AB0F72@microsoft.com>, > "/\\/\\o\\/\\/ [MVP]" <mow001@hotmail.NoSpam> writes > So why does this fail: > > PSH [D:\foo]: $e="[enum]::GetNames([system.consolecolor])" > PSH [D:\foo]: $e > [enum]::GetNames([system.consolecolor]) > PSH [D:\foo]: & $e > The term '[enum]::GetNames([system.consolecolor])' is not recognized as a > cmdlet, function, operable program, or script file. Ver > ify the term and try again. > At line:1 char:2 > + & <<<< $e With a string, you want to use Invoke-Expression e.g.: 2> $e="[enum]::GetNames([system.consolecolor])" 3> Invoke-Expression $e Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow Gray DarkGray Blue Green Cyan Red Magenta Yellow White If you want to call the code later then put it in a scriptblock. 4> $e={[enum]::GetNames([system.consolecolor])} 5> &$e Black DarkBlue DarkGreen DarkCyan DarkRed DarkMagenta DarkYellow Gray DarkGray Blue Green Cyan Red Magenta Yellow White -- Keith |
My System Specs![]() |
| | #13 (permalink) |
| | Re: Translating colors to hex and back In message <9B2E0097-8A08-41C1-84C5-B1E305DCA059@microsoft.com>, Keith Hill <r_keith_hill@mailhot.nospamIdotcom> writes >If you want to call the code later then put it in a scriptblock. > >4> $e={[enum]::GetNames([system.consolecolor])} >5> &$e I knew that... :-) Thanks. Thomas -- Thomas Lee doctordns@gmail.com MVP - Admin Frameworks and Security |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Translating English to Polish | .NET General | |||
| Translating Japanese to English In a browser | Browsers & Mail | |||
| help translating winrm authendication to powershell | PowerShell | |||
| VISTA feels like going back to the Stone Age (in nice colors) [Edited] | Vista General | |||
| Windows Mail Stationery Stopped Working, Also Font colors and background colors... | Vista mail | |||