Script to install based on file type

Welcome Forums General PowerShell Q&A Script to install based on file type

This topic contains 1 reply, has 2 voices, and was last updated by

1 year, 11 months ago.

  • Author
  • #73385

    Topics: 1
    Replies: 0
    Points: 0
    Rank: Member

    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

    Topics: 6
    Replies: 652
    Points: 11
    Rank: Member

    I would probably use the switch statement

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

The topic ‘Script to install based on file type’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort