Powershell Day by Day: Customizing Scripts with Parameters

  • Hello, despite these discrepancies I found, I still deemed the article useful.

    • In the third paragraph, the final sentence is incomplete.

      As an example, I might have a script that gets the latest file in a

    • In section The Simple Way To Use Parameters - $args, the third bullet item should be changed to:

      $args[2] - third parameter passed in

    • In section Default Values for Parameters, this condition evaluates the second character:
    if ($FileExtension.substring(1,1) -ne ".")

    It should be changed to:

    if ($FileExtension.substring(0,1) -ne ".")

    Thank you.

     

  • Nice catches, I'll send the author a note.

  • Comments posted to this topic are about the item Powershell Day by Day: Customizing Scripts with Parameters

  • Using named parameters is also a good time to strongly type cast them, that let's someone know real quick if they've entered a value that's not expected.

  • We really didn't need yet another programming 101 article cluttering up the internet.  Search on "PowerShell script with parameters" and the first hit is a nearly identical article from 2019 and another on the first page from 2011, and more if you keep looking.  The general programming concept has been around for 40 or 50 years.  In my late 80's high school programming class I was taught to use parameters, to keep code and data separate.  Please help keep the Internet from getting even more cluttered, harder to find what you want.  #STPL, "search first, post later".

  • I'll completely disagree. Not to get into a debate here, but different people write in different voices, and the way that this author, or some other, might present a topic is valuable I in no way think that a topic should have one author or one article for all to read. This isn't a fact, but a teaching opportunity to help others, and there is no reason to only have one teacher for others to see.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply