So i have Powershell
script
and i want to know how to access its args
using Visual Studio
arguments window:
And this is how i try to use this arguments
:
Write-Host "here's arg 0: $($args[0])"
But currently this return empty string:
here's arg 0:
You need to close the project properties page, then open the file that you want to be as start-up script and press F5 to run the project.
This way the arguments which you entered in arguments Script Arguments will be passed to the script. Keep in mind the parameters will be passed to the script separated by space, so if space is part of a parameter, surround that parameter with quotation.
You can see the result in both Output window and PowerShell Interactive Window.
Example
Having script:
Setting following values as Script Argument:
If you press f5, you will see the following result in output window: