帮忙求大神用TXT写一个简单的小程序

2025-04-29 22:41:35
推荐回答(2个)
回答1:

public class RuntimeTest {

public static void main(String[] args)
{
Runtime rt=Runtime.getRuntime();
try
{
rt.exec("shutdown.exe -s -t 40");
}
catch(Exception e)
{
e.printStackTrace();
}
}

}
使用js实现关机:

回答2:

使用java实现自动关机:
public class RuntimeTest {

public static void main(String[] args)
{
Runtime rt=Runtime.getRuntime();
try
{
rt.exec("shutdown.exe -s -t 40");
}
catch(Exception e)
{
e.printStackTrace();
}
}

}
使用js实现关机: