Skip to content

Instantly share code, notes, and snippets.

@jheinrichs79
Created January 8, 2019 22:06
Show Gist options
  • Save jheinrichs79/cd30fff4f8b5ffc77954033a12b92289 to your computer and use it in GitHub Desktop.
Save jheinrichs79/cd30fff4f8b5ffc77954033a12b92289 to your computer and use it in GitHub Desktop.
I can run a single line in a powershell file and the script works correctly.
C:\folder\script.ps1 -inputFile "\\Server\share\script01.ps1" -outputFile "\\Server\share\file.exe" -elevated -title 'My Application' -version '1.0.0.0'
What I would like to do is to add some variables so that I can make the call more dynamic. Is there a way to do this?
C:\folder\script.ps1 -inputFile $input -outputFile $output -elevated -title $Title -version $version
@klborders
Copy link

Yus
Just add:

param(
[string]$inputFile,
[string]$outputFile,
[bool]$elevated = $true,
[string]$title,
[string]$version
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment