Untitled
unknown
plain_text
4 years ago
832 B
13
Indexable
first task
function output-name{
$name = Read-Host -Prompt "Enter a word " #get name from user
Write-Host $name.ToUpper() -ForegroundColor Red #display name in capital
}
output-name #for calling that function
second task
function get-time{
Write-Host "Hello, today is " (Get-Date -Format "MM/dd/yyyy") " and the time is " (Get-Date -Format "HH") " hours and " (Get-Date -Format "mm") "minutes"
} #use Get-Date command to get time and date
get-time #for calling the function to display the text
third task
function my-funct{param($text, $color) # function with parameters: "text" & "color"
Write-Host $text -ForegroundColor $color #print given text with given color
}
my-funct -text "hello" -color "red" #for calling the function with parameters "text" & "color"Editor is loading...