Script to install based on file type

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.

I would probably use the switch statement

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