我想在桌面右键菜单新建中添加一项vbs空白脚本,具体该怎么做?不要从别的地方给我复制粘贴这段话,原创

我想在桌面右键菜单新建中添加一项vbs空白脚本,具体该怎么做?不要从别的地方给我复制粘贴这段话,原创,第1张

filetype=".vbs"

Set wshshell=CreateObject("wscript.shell")

prg=readreg("HKCR\"&filetype&"\")

prgname=readreg("HKCR\"&prg&"\")

ask="Vbscript 文件"

title="创建新的vbs脚本"

prgname=InputBox(ask,title,prgname)

wshshell.RegWrite "HKCR\"&prg&"\",prgname

wshshell.RegWrite "HKCR\"&filetype&"\shellnew\nullfile",""

Function readreg(key)

On Error Resume Next

readreg=wshshell.RegRead(key)

If Err.Number>0 Then

Error="error:注册表键值"""&key_&"""不能找到!"

MsgBox Error,vbCritical

WScript.Quit

End If

End Function

以上代码保存为 右键新建vbs.vbs 运行即可

Set wshshell=CreateObject("wscript.shell")

filetype=".vbs"

wshshell.RegDelete "HKCR\"&filetype&"\shellnew\"

MsgBox "command removed!"

以上代码保存为 删除右键新建vbs.vbs

set

ws=createobject("wscript.shell")

do

wscript.sleep

5000

'执行脚本5秒后开始发送

ws.sendkeys"^v"

ws.sendkeys"{enter}"

ws.sendkeys"{enter}"

wscript.sleep

1000

'暂停1秒

loop


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11844104.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存