Writing functions in windows powershell scripting

Functions are used to increase code re-usability. We can create a simple function using below syntax.
 
function f1
{
echo “hello”
}
f1

Passing arguments to the function Below example shows how you can pass parameters to the function. Note that we have passed a parameter -“firstname”
 
function f1
{

Param($firstname)

echo “Your name is $firstname”

}

To call above function, you need to use below syntax.
 
f1 paul

Web development and Automation testing

solutions delivered!!