blooming8

Prompt hello

Apr 8th, 2022
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.util.Scanner;
  3.  
  4. public class Main
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner scan = new Scanner(System.in);
  9.         System.out.println("Il tuo nome?");
  10.         String nome = scan.nextLine();
  11.        
  12.         String saluta = String.format("echo \"Ciao %s! Come stai?\"", nome);
  13.         String colore = "color 0b";
  14.         String info = "chdir";
  15.        
  16.         String cmd = "cmd.exe /c start " + saluta;
  17.        
  18.         try
  19.         {
  20.             Runtime run = Runtime.getRuntime();
  21.             run.exec(cmd);
  22.             run.exec("colore.bat");
  23.             System.out.println("\n>>> PROMPT <<<");
  24.             System.out.println("\nCmd > " + saluta);
  25.         }
  26.         catch (IOException e)
  27.         {
  28.             e.printStackTrace();
  29.         }
  30.        
  31.         System.out.printf("\n %s", cmd);
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment