Skip to content

Latest commit

 

History

History
80 lines (67 loc) · 3.18 KB

2019-10-29.md

File metadata and controls

80 lines (67 loc) · 3.18 KB

Desarrollo de software


Ejecutar un programa desde un lenguaje de programación

Ejecutar desde Java

Ejecutar desde PowerShell

Cosas que puede hacer un código en PowerShell

Ejemplo de Raúl

import java.io.IOException;

/**
 *
 * @author Usuario DAM 1
 */
public class Cmd {
public static void main (String[] args){
try {
	String [] cmd = {"shutdown","-s","-t", "10"};
	Runtime.getRuntime().exec(cmd);
} catch (IOException ioe) {
	System.out.println (ioe);
}
}
}

Ejemplo de Álvaro I.

import java.io.IOException;

public class AbrirGoogle {

    public static void main(String[] args) {
        int i = 1;
        do {
            try {

                String command = "cmd /C start /wait chrome";
                Runtime.getRuntime().exec(command);
            } catch (IOException e) {
            }
            //cambias a while(i!=0) y se abren chrome infinitos
        } while (i == 0);
    }

}

Introducción a Scrum