1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import java.io.BufferedReader import java.io.InputStreamReader fun main() { val command = "powershell.exe -ExecutionPolicy Bypass -File C:\\ruta\\script.ps1" val process = Runtime.getRuntime().exec(command) process.waitFor() val reader = BufferedReader(InputStreamReader(process.inputStream)) var line: String? while (reader.readLine().also { line = it } != null) { println(line) } reader.close() } |