Contenidos
Ejecutar desde Java
- https://www.jesusninoc.com/10/11/ejecutar-y-guardar-el-comando-arp-utilizando-processbuilder/
- https://www.jesusninoc.com/02/10/ejecutar-en-java-un-cmdlet-de-powershell-en-base64/
- https://www.jesusninoc.com/02/09/crear-compilar-generar-y-ejecutar-un-jar-de-java-que-ejecuta-un-cmdlet-de-powershell-utilizando-runtime/
- https://www.jesusninoc.com/02/09/compilar-y-ejecutar-una-clase-de-java-que-ejecuta-un-cmdlet-de-powershell-utilizando-runtime/
- https://www.jesusninoc.com/02/08/crear-compilar-y-ejecutar-una-clase-de-java-que-ejecuta-un-cmdlet-de-powershell-utilizando-runtime/
- https://www.jesusninoc.com/02/08/ejecutar-el-cmdlet-get-nettcpconnection-de-powershell-en-java/
- https://www.jesusninoc.com/02/07/ejecutar-una-clase-de-java-que-ejecuta-un-cmdlet-de-powershell-utilizando-runtime/
Ejecutar desde PowerShell
Cosas que puede hacer un código en PowerShell
Ejemplo de Raúl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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); } } |