How can I pass an argument to a PowerShell script?

There are multiple ways you can pass arguments in a PowerShell script. You can use param to pass parameters to your script or access the passed argument by position with the system variable $args[]. Let’s explain with an example

Using args[]

Using param