【发布时间】:2021-09-21 08:37:53
【问题描述】:
WOL 通过路由器可以很好地工作,但这需要登录到控件并通过菜单浏览。我想通过单击(双击)唤醒机器。
我试过了
-
https://www.itprotoday.com/compute-engines/q-how-can-i-easily-send-magic-packet-wake-machine-my-subnet
(链接来自PowerShell - If/Else Statement Doesn't Work Properly) - Running a WOL PowerShell script through a batch file
两者都会抛出语法错误,我是否使用 cmd 或 PowerShell 尝试它们。
Bash one-line command to send wake on LAN magic packet without specific tool 可能适用于linux,但绝对不适用于windows
是否有适用于 Windows 的单行程序或任何我可以放入实际有效的 bash 批处理文件的内容?
编辑:
我让第二个脚本运行(重命名为 .ps1,更改了 PowerShell 中的执行策略),但没有运行。
试过https://www.itnator.net/wake-lan-script-wol/ 但这会引发异常:
Send-Packet : Ausnahme beim Aufrufen von "Parse" mit 1 Argument(en): "Die angegebene physikalische Adresse ist
ungültig."
In C:\wol-script.ps1:38 Zeichen:1
+ Send-Packet <mac-address>
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Send-Packet
Fehler beim Durchlaufen einer Auflistung: Die Sammlung wurde geändert. Der Enumerationsvorgang kann möglicherweise
nicht ausgeführt werden..
In C:\wol-script.ps1:29 Zeichen:3
+ $Error | Write-Error;
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Collecti...numeratorSimple:ArrayListEnumeratorSimple) [], Runt
imeException
+ FullyQualifiedErrorId : BadEnumeration
【问题讨论】:
-
你可以使用 go-wol。它是跨平台的。您还可以为您的 mac 地址设置别名。 github.com/sabhiram/go-wol/releases
-
@sigkilled 下载并尝试了 - 没有效果。让另一台机器上的eth0监听广播;没有效果。虽然没有错误;这就是进步。我用的是 Intel CPU 而不是 AMD 会有什么不同吗?
-
如果我没记错的话应该没什么区别。因为它是以太网标准。您在用于发送魔术包的机器上是否有多个以太网适配器?
-
@sigkilled only eth0;其他一切都被禁用。它声称数据包已成功发送。
-
两台电脑之间有路由器吗?尽管您收到了成功消息,但我不确定计算机是否已收到魔术包
标签: windows wake-on-lan