Script to install based on file type

This topic contains 1 reply, has 2 voices, and was last updated by  Curtis Smith 4 months ago.

  • Author
    Posts
  • #73385

    Joshua Bregler
    Participant

    I feel like this probably exists somewhere already but I have yet to find it.

    I'd like to be able to have the script look into a folder, enumerate the files (patches [exe, msi, msp]), and run a command based on the file type for each. I have what I think it could be in my head but it's been awhile since I wrote this much custom powershell and I'm finding myself quite rusty. Any help, even just some architecture notes, would be very much appreciated.

  • #73391

    Curtis Smith
    Participant

    I would probably use the switch statement

    Switch ($ext){
    "exe" {exe command}
    "msi" {msi command}
    "msp" {msp command}
    }
    

You must be logged in to reply to this topic.