2010-11-02 48 views
1

我正在使用yuicompressor來縮小和混淆一些javscript文件。我試圖動態構建文件路徑並將它從powershell傳遞給minifier。將參數傳遞給powershell中的程序時遇到問題

這裏是什麼工作:

$results = java -jar c:\yui\yuicompressor-2.4.2.jar c:\MyFile.js -v --charset utf-8 

這裏是行不通:

$yuiPath = "c:\yui\yuicompressor-2.4.2.jar" 
$filePath = "c:\MyFile.js" 

$results = java -jar $yuiPath $filePath -v --charset utf-8 

它顯然不順心的$filePath -v --charset utf-8一部分,因爲我順利拿到的YUICompressor幫助文本當我運行它。有什麼建議麼?

回答

1

我想通了。文件「c:\ MyFile」的路徑實際上沒有擴展名,所以我需要通過--type js作爲參數

0

可以使用Join-Path cmdlet並試用它。

相關問題