TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Pass variable (parameters) to powershell?

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 1.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      ef3h37b6
      last edited by

      I'm trying to pass a variable (a link) to a powershell script, but when I enable parameters, the script doesn't run. It runs if I call the script without parameters. And how is the variable captured in powershell? Thanks.

      RussR 1 Reply Last reply Reply Quote 0
      • RussR Offline
        Russ @ef3h37b6
        last edited by Russ

        @ef3h37b6, I did a test and it worked for me.

        I used this powershell script, saved as d:\tools\urltest.ps1, and made a TRIGGERcmd command with powershell d:\tools\urltest.ps1 as the Command field and with Allow Parameters set to true.

        param (
            [string]$URL
        )
        start $URL
        

        I used the triggercmd.com website's orange Parameters button to send it a URL as a parameter, like this:

        c04ae531-abbe-450e-b367-dc6e5e369adf-image.png

        It opened yahoo.com in my default browser, as it should.

        Please tell me more about what you've tried that's not working.

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • E Offline
          ef3h37b6
          last edited by

          Awesome, got it working. Thank you.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post