CKS
CKS

Reputation: 537

How to pass user variables from TFS 2015 Build definition to power shell script?

I am working on vNext builds TFS 2015. How can we pass a user defined variable from vNext build to power shell script? I am adding powershell script as a step in the build definition.

Upvotes: 8

Views: 5248

Answers (2)

You Can access the V next user variables in power shell like below,

Example:

$env:foo

In your case it is,

blah.ps1 -foo $env:foo

Upvotes: 1

Dylan Smith
Dylan Smith

Reputation: 22235

You can define build variables, then reference them in the PowerShell task under arguments. For example if my powershell script took a parameter called foo I could do this:

enter image description here enter image description here

Upvotes: 15

Related Questions