【发布时间】:2020-12-24 06:19:09
【问题描述】:
我在 autohotkey 脚本块中遇到了 powershell 问题。我的 ahk 文件中的代码块如下:
psSetTime = (
$service = Get-Service W32Time
if ($service.Status -eq 'Stopped'){
$service | Set-Service -StartupType Automatic
$service | Start-Service -PassThru}
w32tm /resync /rediscover
w32tm /query /status
)
Run Powershell.exe -NoExit -command &{%psSetTime%}
当我加载文件时会弹出结果错误。它指出“以下变量名包含非法字符”。错误屏幕中的字符绝对不存在于我的 ahk 文件中。 error screenshot
我目前正在使用 AHK 1.1.33.02 感谢任何建议。
【问题讨论】:
-
通过手动重新输入来替换引号。
-
不是引号,
-eq周围的空格。它们可能是从网站复制而来的不间断空格或其他特殊字符。
标签: powershell autohotkey