2

I want to run TextTransform.exe with the parameter args on my template while in PowerShell v3. Here are my variables and the options I tried. Note that it works with no '-a' parameters, but I need the args to run the template correctly.

$textTransformPath = "C:\Program Files (x86)\Common Files\Microsoft Shared\TextTemplating\14.0\TextTransform.exe"
$templateath = "$ProjectPath\TheTemplate.tt"
$textTransformParams = "-a !!TheParam!$TheValue"

#& "$textTransformPath" "$templatePath" <-- this runs, but no args!

# these don't work:
& "$textTransformPath" "$templatePath" $textTransformParams
& "$textTransformPath" "$templatePath" "$textTransformParams"

I don't know why this is so difficult, it seems like it should be really easy. If I type out this in the standard command line it works, which verifies the problem is with my PS syntax.

Steve Kinyon
  • 805
  • 1
  • 7
  • 15

1 Answers1

2

It never fails...one last search after almost giving up and found the answer:

Using $(SolutionDir) when running template via TextTransform.exe

The combo I apparently didn't try previously was:

& "$textTransformPath" "$templatePath" -a !!TheParam!$TheValue

Hope this helps someone else.

Community
  • 1
  • 1
Steve Kinyon
  • 805
  • 1
  • 7
  • 15