标题:
[其他]
批处理调用vbs的语法问题:执行快捷方式模拟按键
[打印本页]
作者:
tf2713
时间:
2020-12-4 20:17
标题:
批处理调用vbs的语法问题:执行快捷方式模拟按键
大家好,我想生成一个执行按键模拟收入的快捷方式,即执行快捷方式后会模拟按键
快捷方式目标为
mshta.exe
VBScript:CreateObject("WScript.Shell").SendKeys("^%{LEFT}")(window.close)
用vbs写的为
Set a=WScript.CreateObject("WScript.Shell")
set b=a.CreateShortcut(a.CurrentDirectory & "\上首.lnk")
b.TargetPath="
mshta.exe
"
b.Arguments="
VBScript:CreateObject(""WScript.Shell"").SendKeys(""^{LEFT}"")(window.close)
"
b.IconLocation=a.CurrentDirectory & "\Pintf.exe,3"
b.WorkingDirectory=a.CurrentDirectory
b.Save
但因为我还要执行后续的操作,需要把vbs转批处理
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\上首.lnk""):b.TargetPath=""
mshta.exe
"":b.IconLocation=""%~dp0Pintf.exe,3"":b.Save:close")
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\上首.lnk""):b.Arguments=""
VBScript:CreateObject(""WScript.Shell"").SendKeys(""^{LEFT}"")(window.close)
"":b.Save:close")
批处理中,VBScript:CreateObject(""WScript.Shell"").SendKeys(""^%{RIGHT}"")(window.close") 直接这样写会报错,估计是语法格式问题,请高手帮忙修改下,让批处理执行会可以创建快捷方式,且目标为
C:\Windows\system32\mshta.exe VBScript:CreateObject("WScript.Shell").SendKeys("^{LEFT}")(window.close)
注意:我是需要是批处理
作者:
tf2713
时间:
2020-12-4 20:26
解决了,是双引号问题,两个"等于一个"
mshta VBScript:Execute("Set a=CreateObject(""WScript.Shell""):set b=a.CreateShortcut(a.SpecialFolders(""Desktop"") & ""\下首.lnk""):b.Arguments=""VBScript:CreateObject(""""WScript.Shell"""").SendKeys(""""RIGHT}"""")(window.close)"":b.Save:close")
欢迎光临 批处理之家 (http://bbs.bathome.net/)
Powered by Discuz! 7.2