2

I'm writing some PowerShell scripts to work with our source control software (which is not a PowerShell cmdlet) and I'm running into a problem using variables as command line arguments when they are preceded by an =, like this:

cm mklabel lb:BL$baseline -c=$comment 

This ends up create a label in with the comment of "$comment". If I put a space after the =, it looks like it evaluates the variable properly, but the command does not associate the comment with -c argument anymore. Is there a way to force the variable to be evaluated despite the =?

2 Answers 2

2

Try:

cm mklabel lb:BL$baseline -c=($comment) 
Sign up to request clarification or add additional context in comments.

2 Comments

I knew it was going to be something simple like that, thanks!
@Ajj Both, excited to get the answer, frustrated that it wasn't easier to find. ;)
2

Try

cm mklabel lb:BL$baseline "-c=$comment" 

1 Comment

That might work, but the $comment itself contains quotes, so I think that causes issues.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.