I fail to execute chef recipe with the command chef-client.bat -z -o "recipe[cookbook::recipe]" inside java method in specific folder (e.g C:\CItool\chef-project. The problem is that chef-client.bat requires to be run as Administrator. How can I do that ?
String line;
Process process=Runtime.getRuntime()
.exec("chef-client.bat -z -o \"recipe[cookbook::recipe]\"",
null, new File("C:\CItool\chef-project"));
BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.print(line);
}