Answer the question
In order to leave comments, you need to log in
Powershell how to compose a command correctly?
The task to transfer data to the
PS site It is launched by such a command, where %s is data PowerShell.exe C:\script.ps1 %s
The command itself:
$id = $args[0]
invoke-RestMethod -Uri "http://site.com/$id" -Method GET
Answer the question
In order to leave comments, you need to log in
no, it doesn't add anything. tried like this:
$id = $args[0]
$id
" https://www.google.com/search?q=$id "
invoke-RestMethod -Uri " https://www.google.com/search?q =$id " -Method GET
what I pass to the script from the command line - is searched in Google as it was passed without any changes.
how do you run the script?
which version turned - $psversiontable?
Is the site supposed to add something? if you just output the URL that you pass to the restmethod to the console - is it already with the addition or already without it?
have you tried it on another machine?
have you tried it on another site?
Is $id something numeric or text?
but about right ... scripts of such length and complexity do not operate with the concepts of right or wrong. instead, they have another property that is important - whether it works or not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question