0

In PowerShell, you can return a path in a function, and then execute the resulting variable like this:

Function GetMSBuildExe {
# Code that sets the value of $MSBuildExe
Return $MSBuildExe
}

$MSBuildExe= GetMSBuildExe
&$MSBuildExe MySolution.sln

Is there a way I can simply run the MSBuildExe without copying into a variable first? Doing this simply prints ou the GetMSBuildExe result:

&GetMsBuildExe MySolution.sln

Thanks!

1 Answer 1

1

Put the function in parenthesis so it gets evaluated first :

&(GetMsBuildExe) MySolution.sln

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.