Advanced Function Parameters in Powershell

preview_player
Показать описание

Learn some of the simple ways to create robust functions
Рекомендации по теме
Комментарии
Автор

after watching dozens of videos, i understood what a parameter is on the first minute of your video. tysm

gguilhermepamplona
Автор

Endless pit of darkness and despair....lol!

laranotout
Автор

Pretty excellent tutorial, good stuff

Enos
Автор

When will you reach the depth of darkness and despair? I’ll wait for the video.


Anyways good job mate!!!

Sproutzie
Автор

To make your powershell neater, try this nifty example trick.

Param(
[Parameter(Mandatory=$true,
Position=0,
HelpMessage="The path to run the script on")]
[string]$Path,
[Parameter(Mandatory=$false,
Position=1,
HelpMessage="Region code blacklist")]
[string]$RegionCode
) #end param

This example works just as splendidly as a one liner for each [Parameter()], due to Powershell's nature to ignore whitespace and newlines after a comma. And you'll most definitely get points for code **A E S T H E T I C S** by using such techniques.

Just be aware that you cannot place comments in between these lines, until after the declaration of the parameter name itself. (You wouldn't put a comment smack dab in the middle of an array, would you?)

lupinedreamexpress
Автор

Was really good video but its a shame you didn't do a test for each parameter

Johnwild
Автор

why u stopped making videos? Please start making videos again.

abbeydudeuk
Автор

I'm trying to make it so when you type:

(by the way, $variable is a secure system string)
read $variable
write-host "$read"

but it's not working,
here is my function:
function read {

    param ($parsation1)
    
    $marshal =
    
   
    
}

It's not the Read-Host code lines

mcminecrafterzombie