20
loading...
This website collects cookies to deliver better user experience
Runtime.getRuntime();
Runtime.getRuntime().exec();
import java.lang.Runtime;
import java.util.Scanner;
public class ShutDown {
public static void main(String[] args)throws Exception {
Scanner sc = new Scanner(System.in);
System.out.println("Enter Password");
String pass = sc.next();
if(pass.equals("xyz")) {
System.out.println("Welcome, you entered correct password");
}
else {
System.out.println("You entered wrong password, soon your machine will shut down automaticallly");
run.exec("shutdown -s");
}
}
}
run.exec("shutdown -s -t");
run.exec("shutdown -r");
run.exec("shutdown -r -t");
run.exec("shutdown -l");
run.exec("shutdown -l -t");
run.exec("c:/windows/system32/rundll32.exe user32.dll, LockWorkStation");
import java.io.IOException;
public class SystemApp {
public static void main(String[] args) {
try {
Runtime run = Runtime.getRuntime();
String path = "C:\\Users\\hp\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe";
Process process = run.exec(path);
} catch (IOException e) {
e.printStackTrace();
}
}
}