Scripting VBScript:第1行字符1中存在无效字符800A0408编译错误

Scripting VBScript:第1行字符1中存在无效字符800A0408编译错误,scripting,Scripting,您好,我是新来做这件事的,上面写着[在这里输入图像描述][1] [1] :这是脚本 do wscript.sleep 100 wshshell.sendkeys “{CAPSLOCK}” wshshell.sendkeys “{NUMLOCK}” wshshell.sendkeys “{SCROLLLOCK}” loop``` 脚本中有智能引号。在编码时尽量避免使用它们 将其更改为直接引号: Debug.Print "Start" Set wshshell = Crea

您好,我是新来做这件事的,上面写着[在这里输入图像描述][1]

[1] :这是脚本

do
wscript.sleep 100
wshshell.sendkeys “{CAPSLOCK}”
wshshell.sendkeys “{NUMLOCK}”
wshshell.sendkeys “{SCROLLLOCK}”
loop```


脚本中有智能引号。在编码时尽量避免使用它们

将其更改为直接引号:

Debug.Print "Start"

Set wshshell = CreateObject("WScript.Shell")
ctr = 1
Do
   Debug.Print "Loop " & ctr
   wscript.Sleep 1000  ' one second
   wshshell.SendKeys "{CAPSLOCK}"
   wshshell.SendKeys "{NUMLOCK}"
   wshshell.SendKeys "{SCROLLLOCK}"
   ctr = ctr + 1
Loop

抱歉,我的代码没有完全放在Set wshShell=wscript.CreateObject(“wscript.Shell”)do wscript.sleep 100 wshShell.sendkeys“{CAPSLOCK}”wshShell.sendkeys“{NUMLOCK}”wshShell.sendkeys“{scrollock}”循环代码已更新。您可以删除调试语句。我用它们来测试。