Script to install based on file type

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Curtis Smith Curtis Smith 1 month, 1 week ago.

  • Author
    Posts
  • #73385
    Profile photo of Joshua Bregler
    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
    Profile photo of Curtis Smith
    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.