2016-04-11 22 views
1

私はpowershell_script料理ブックを使用しています。私が使用したいPowerShellスクリプトには、コマンドライン入力が必要です。シェフから変数を渡してpowershellスクリプトに渡す方法はありますか?シェフからpowershellに変数を渡す

だから、
input1 = "input1" 
input2 = "input2" 

powershell_script 'example' do 
    code "...\example.ps1" 
end 

コマンドライン引数は、どのように私はにそれらを渡すように私example.ps1がINPUT1とINPUT2かかった場合:

code "...\example.ps1"

+0

[PowerShellのコマンドライン引数を処理する方法]の可能な重複(http://stackoverflow.com/questions/2157554/how-to-handle-command-line-arguments-in-パワーシェル) –

答えて

2

powershell_scriptリソース上codeプロパティは、リテラルPowerShellのコード表示されます実行したい、それへの道ではない。それにかかわらず、文字列補間で処理します。たとえば、次のように

execute "C:/path/to/example.ps1 #{node['foo']} #{node['bar']}" 
関連する問題