Java启动应用程序[WINDOWS]
我有一个简单的java代码,可以关闭电脑。我可以添加什么来在Windows启动时运行它Java启动应用程序[WINDOWS],java,startup,Java,Startup,我有一个简单的java代码,可以关闭电脑。我可以添加什么来在Windows启动时运行它 import java.io.IOException; import java.io.OutputStream; public class Spegni { public static void main(String[] args) { Runtime runtime = Runtime.getRuntime(); try { Process process = runt
import java.io.IOException;
import java.io.OutputStream;
public class Spegni {
public static void main(String[] args) {
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec("C:\\WINDOWS\\system32\\cmd.exe");
OutputStream os = process.getOutputStream();
os.write("shutdown -s -f -t 0\n\r".getBytes());
os.close();
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
开始,运行:
shell:startup
然后把捷径放在那里。快乐的拖曳。开始,跑步:
shell:startup
然后把捷径放在那里。祝您玩得愉快。您想在启动时关机吗!!!!!?是的,我只想这样做。这与安装程序有关,或者你可以在windows中创建任务,没有其他选择。你想在启动时关机吗!!!!!?是的,我只想这样做。这与安装程序有关,或者您可以在windows中创建任务,没有其他选择。