2016-11-18 35 views
0

我想在PowerShell v3中使用模板上的參數args運行TextTransform.exe。這裏是我的變數和我嘗試的選項。請注意,它沒有'-a'參數,但我需要參數才能正確運行模板。使用Powershell中的參數運行TextTransform.exe

$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" 

我不知道爲什麼這是如此困難,它似乎應該很容易。如果我在標準命令行中輸入它,它會起作用,這證明問題出在我的PS語法上。

回答

相關問題