'this is file extension the command
'should generate
filetype=".vbs"
'connect to WScript.Shell registry access
set WSHShell = CreateObject("WScript.Shell")
'read in the name of vbs-section
prg = ReadReg("HKCR/"&tiletype&"/")
prgname = ReadReg("HKCR/"&prg&"/")
'ask for a new name
ask = "What Should be the name for new VBScript script"
title="新建 Vb 脚本"
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:Registry-key"""&key&"""could not be found!!"
MsgBox error.vbCritical
WScript.Quit
end if
end function
'should generate
filetype=".vbs"
'connect to WScript.Shell registry access
set WSHShell = CreateObject("WScript.Shell")
'read in the name of vbs-section
prg = ReadReg("HKCR/"&tiletype&"/")
prgname = ReadReg("HKCR/"&prg&"/")
'ask for a new name
ask = "What Should be the name for new VBScript script"
title="新建 Vb 脚本"
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:Registry-key"""&key&"""could not be found!!"
MsgBox error.vbCritical
WScript.Quit
end if
end function
博客主要围绕 Vb 脚本展开,设置了文件扩展名.vbs,通过创建 WScript.Shell 对象连接注册表进行操作,读取注册表信息,还可输入新的 Vb 脚本名称并写入注册表,同时定义了读取注册表的函数。
3060

被折叠的 条评论
为什么被折叠?



