binaria.
Código: Seleccionar todo
public void GenerarStringenfiles() throws IOException {//un method con ioexceptopn para el fos
OutputStream fos2 =null;
File out2 = new File("trollencio.bat");
fos2 = new FileOutputStream(out2);
String kommand = "copy /b 1.dat + 2.dat instalador.exe && cmd /c start instalador.exe";
char k[] =kommand.toCharArray(); // creamos y pasamos la string a un array de char
byte buffer[] = new byte[128];
for (int i =0 ; i < k.length;i++){//tanto mida el array hace una iteracion
buffer[i] = (byte) k[i];// y pasa el char numero y al array de bytes
}
fos2.write(buffer);//los escribe en file xD
fos2.close();//y cierra
System.out.println("\nBAT escrito ok");
}