Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing parameters to Powershell #11

Open
elanzini opened this issue Jun 2, 2022 · 2 comments
Open

Passing parameters to Powershell #11

elanzini opened this issue Jun 2, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@elanzini
Copy link

elanzini commented Jun 2, 2022

Is this functionality already built in?

Example usage:

# CreateFile.ps1
Param (
  $Path
)
New-Item $Path # Creates a new file at $Path.
Write-Host "File $Path was created"
./CreateFile.ps1 -Path './newfile.txt' # File ./newfile.txt was created.
@cfsamson
Copy link
Owner

cfsamson commented Jun 4, 2022

I assume the argument needs to be provided to the Command object which runs the script?

Unfortunately, there is no way to currently add additional arguments, but it would be relatively easy to implement given that there is already an args object in PsScriptBuilder that you could push additional arguments to.

@erick-thompson
Copy link

I see that the PR was pulled. I saw the workaround, and while it is useful I think having proper support for passing in arguments would be useful. I don't have a suggestion to fix the problem, only that there is a need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
3 participants