Well my problem isn't making the color, I already did that and it works fine. I have the problem with the old parameters of the Read-Host cmdlet like -AsSecureString. Is there any way, I can say that my new function should import all the parameters from the Read-Host cmdlet and just have a new one for the color? Here's my for now working script:
#Read-Text
#You can give the Read-Host command another color instead of just white with this function.
#Example:
#Read-Text -Fore Yellow "Type something"
#You can also still save it into a variable:
#$a = Read-Host -Fore Yellow "Type something"
#Write-Host $a
Function Read-Text
{
Param($Fore, [String]$Text)
If ($Fore)
{
[console]::ForegroundColor = $Fore
}
Read-Host $Text
[console]::ResetColor()
}Thanks for your help.
The following is my signature:
Powershell Programmer & Advanced Lua Programmer
Location: Switzerland
Beside that, whenever you see a reply, you think is helpful, click "Vote As Helpful"! And whenever you see a
reply being an answer to the main question of the thread, click "
Mark As Answer" (if you opened the thread).
I published the URL's for the icons in my signature.
Please contact me, before reporting me, thank you.
[string](0..21|%{[char][int]([int]("{0:d}" -f 0x28)+('577076797174-87661607769657424-8687168065964').substring(($_*2),2))})-replace' '