New
#1
Pass an argument from a .bat file to PowerShell script
I have subscribed to a push notification service in order to be able to send push notifications to my phone.
Here is the PowerShell script:
I have not included the actual token or user values, but when I do, and I call this from a .bat file, it works.Code:$uri = "https://api.pushover.net/1/messages.json" $parameters = @{ token = "token" user = "user" message = "Push Message" } $parameters | Invoke-RestMethod -Uri $uri -Method Post
Here is the .bat file:
What I want to be able to do is insert a text message into the .bat file and pass it to the powershell script. The text could be a literal string or a file reference.Code:Powershell.exe -executionpolicy remotesigned -File C:\Users\Stan\Desktop\PushOverPS.ps1
How would I do either?
Thanks.
Windows 10 Pro 18363.1139