从Linux终端关闭Windows计算机
问题描述:
我正在linux机器上运行一个应用程序.通过提供Windows计算机的IP地址作为输入,应用程序必须关闭Windows计算机.如果这些机器运行相同的操作系统,这是非常容易的,但是我对如何在跨操作系统中执行该操作感到困惑.
I am running an application on linux machine. By giving the ip address of a windows machine as input, the application must shutdown the windows machine. If the machines run the same OS it is very easy but I'm confused how to do it in cross OS.
答
从Linux-:
$ net rpc -S <ip address> -U <username>%<password> shutdown -t 1 -f
此命令可以从bash发出,甚至可以在cron作业中设置以在特定时间关闭计算机,并且默认情况下,此命令附带了许多发行版.
This command can be issued from bash or even set in cron job to shutdown the computer at a specific time and this command is shipped with many distros by default.