我有一个名为taskkill()的方法,用java编写。我想在所选字段中实现cmd命令taskkill(如图所示)。我不知道如何在java中应用此命令。请帮忙。
public static Timer taskkill() {
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
// TO APPLY CMD COMMAND [ TASKKILL /F /FI "WINDOWTITLE ne File1" /FI "WINDOWTITLE ne File2" ]
}
};
Timer timer = new Timer("MyTimer"); //create a new Timer
timer.scheduleAtFixedRate(timerTask, 30, 10000); //this line starts the timer at the same time its executed
return timer;