【问题标题】:Shutdown a PC on LAN from another PC using a batch file in Windows 7使用 Windows 7 中的批处理文件从另一台 PC 关闭 LAN 上的 PC
【发布时间】:2012-07-03 09:51:52
【问题描述】:

我只是想知道:如果两台 PC 在同一个 LAN 上,我们能否使用批处理文件从另一台 PC 关闭一台 PC?

【问题讨论】:

    标签: windows batch-file shutdown lan


    【解决方案1】:

    是的,您可以像这样将/m 开关用于shutdown

    shutdown /s /m \\computer1 /t 0
    

    【讨论】:

      【解决方案2】:

      从以具有正确权限的用户身份运行的批处理中调用shutdown 命令或使用psshutdown。

      【讨论】:

      • shutdown -s -t 2 是关闭我的电脑的代码。我想从我的电脑上关闭另一台电脑。
      • /m \\<ComputerName> :指定目标计算机
      • shutdown -s /m \\amith-016 -t 2 我使用此代码,但它不起作用
      • 好吧,你不能随意关闭网络上的计算机..这会导致问题。您需要在具有正确权限的用户下运行命令 - 例如目标 PC 上的管理员或将凭据传递给 psshutdown
      【解决方案3】:

      最简单的方法:

      set computertoshutdown=COMPUTERNAME
      set timetoshutdown =TIMEtoSHUTDOWN
      set message=MESSAGE
      
      shutdown -s -m \\%computertoshutdown% -t %timetoshutdown% -c "%message%"
      

      【讨论】:

        【解决方案4】:

        这应该可以,但是您可以关闭 wifi 范围内的任何计算机以查找计算机的名称按 Win+Pause+Break 同时打开所有键,然后转到计算机名称。

        @Echo off
         cd\
         Echo Saman=Program
         REM ****************************
         REM * Program Variables *
         REM ****************************
        
         set varcomputer=[computername]
         goto loop
         :[computername]
        
         Exit
        
         REM ****************************
         REM * Program *
         REM ****************************
        
         :loop
         echo Shutting down %varcomputer%.
         shutdown -s -m \\%varcomputer% -t 600 -c "The computer is shutting down. Please save your work."
         goto %varcomputer
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-11-19
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多