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 · 1 comment
Open

Passing parameters to Powershell #11

elanzini opened this issue Jun 2, 2022 · 1 comment

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants