【发布时间】:2015-08-05 17:12:38
【问题描述】:
我以前没有做过厨师。下面的代码看起来正确吗?
batch 'windows_batch' do
code <<-EOH
C:\bootstrap\SInstaller.exe /S /APIKEY=hththfthtfdh
EOH
end
命令是静默安装SInstaller.exe
【问题讨论】:
标签: chef-infra
我以前没有做过厨师。下面的代码看起来正确吗?
batch 'windows_batch' do
code <<-EOH
C:\bootstrap\SInstaller.exe /S /APIKEY=hththfthtfdh
EOH
end
命令是静默安装SInstaller.exe
【问题讨论】:
标签: chef-infra
我建议您改用powershell_script
powershell_script 'windows_batch' do
code <<-EOH
Start-Process "cmd.exe" "/c C:\\bootstrap\\SInstaller.exe /S /APIKEY=hththfthtfdh"
EOH
end
此脚本运行 cmd 进程的新实例并在其中运行命令C:\bootstrap\SInstaller.exe /S /APIKEY=hththfthtfdh。
对我来说,batch 有时有点麻烦。
尝试使用它并告诉我它是否有效!
如果您仍然喜欢使用batch 资源,则必须使用 \ 编写路径,例如
C:\\bootstrap\\SInstaller.exe /S /APIKEY=hththfthtfdh 否则会出错
Invalid escape character syntax
C:\bootstrap\SInstaller.exe /S /APIKEY=hththfthtfdh
^
您的其余代码对我来说似乎没问题。
【讨论】: