您的位置:

java主机控制远程机器关机(java远程控制电脑)

本文目录一览:

如何实现远程计算机/服务器的开机和关机

远程开机:

使用远程唤醒技术(WOL,Wake-on-LAN),计算机只要处于同一局域网内,就能够被随时启动。它通过局域网内计算机网卡的MAC地址,用软件发送包含该地址的特殊数据包以唤醒计算机。

被控制计算机的硬件需求:

实现网络开机,需要主板、网卡、电源3个设备支持。首先需要查看主板和网卡使用说明书,查看主板和网卡是否支持Wake-up On LAN(WOL)技术,如果支持就说明能够实现远程开机。另外,电脑必须安装有符合ATX 2.03标准的ATX电源,+5VStandby电流至少应在720mA以上。

其实就目前新配置的计算机而言,一般都支持网络开机。

CMOS设置 :首先在启动时按DEL进入CMOS参数设置。选择电源管理设置“Power Management Setup”菜单,将“ModemRing/WakeOnLAN”项和“PME Event Wakeup”项均设置为“Enable”,启用该计算机的远程唤醒功能(主板自带网卡的,主板不同,这些选项也不完全相同)。

在控制端装上远程开机的软件NetWaker,运行后在界面MAC地址栏中中输入被控计算机MAC地址,点击“发送开机信号”就能唤醒该地址的计算机了。

远程关机:

在桌面连接窗口中我们是不能用“开始→关闭计算机”的步骤来关机的。我们这里采用了系统自带的shutdown命令来控制。可以两种方法实现:①在控制窗口中的计算机桌面中点击“开始→运行”输入“shutdown –s –t 30”命令来实现关机。②在本机上运行“shutdown –s –m\\被控计算机名 -t 30”,这种方法还要在对方的计算机中组策略中设置,赋予guest用户远程关机的权限。

利用java编程,控制计算机关机

哈哈,这个我正好可以帮你,以前写了类似程序

开机运行:String regKey = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";

String myAppName = "DaKa";

try {

Runtime.getRuntime().exec("reg " + (isStart ? "add " : "delete ") + regKey + " "

+ myAppName + (isStart ? " /t reg_sz /d " + dirpath : " /f"));

dirpath是你当前文件的绝对路径(包括文件名)

关机:Runtime.getRuntime().exec("shutdown -s -f -t 10");

java怎么实现远程关闭计算机,远程唤醒的做好了,远程关机的不知道该怎么做

有管理员权限吧,那用shutdown命令就可以了

shutdown -m \\192.168.0.10 -f -s -t 0

shutdown /? 看看帮助信息。

C:\Windows\system32shutdown /?

Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]

[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

No args Display help. This is the same as typing /?.

/? Display help. This is the same as not typing any options.

/i Display the graphical user interface (GUI).

This must be the first option.

/l Log off. This cannot be used with /m or /d options.

/s Shutdown the computer.

/r Shutdown and restart the computer.

/g Shutdown and restart the computer. After the system is

rebooted, restart any registered applications.

/a Abort a system shutdown.

This can only be used during the time-out period.

/p Turn off the local computer with no time-out or warning.

Can be used with /d and /f options.

/h Hibernate the local computer.

Can be used with the /f option.

/e Document the reason for an unexpected shutdown of a computer.

/m \\computer Specify the target computer.

/t xxx Set the time-out period before shutdown to xxx seconds.

The valid range is 0-315360000 (10 years), with a default of 30.

If the timeout period is greater than 0, the /f parameter is

implied.

/c "comment" Comment on the reason for the restart or shutdown.

Maximum of 512 characters allowed.

/f Force running applications to close without forewarning users.

The /f parameter is implied when a value greater than 0 is

specified for the /t parameter.

/d [p|u:]xx:yy Provide the reason for the restart or shutdown.

p indicates that the restart or shutdown is planned.

u indicates that the reason is user defined.

If neither p nor u is specified the restart or shutdown is

unplanned.

xx is the major reason number (positive integer less than 256).

yy is the minor reason number (positive integer less than 65536).