'保存.vbs文件
'把第五行filetype = ".vbs"中的.vbs 改为.bat 就能在右键的新建菜单中看增加.bat了
' this is the file extension the new command
' should generate:
filetype = ".vbs"
set WSHShell = CreateObject("WScript.Shell")
prg = ReadReg("HKCR\" & filetype & "\")
prgname = ReadReg("HKCR\" & prg & "\")
ask = "What should be the name for new VBScript scripts?"
title = "New menu entry"
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
' key could not be read: complain!
error = "Error: Registry-Key """ & key _
& """ could not be found!"
MsgBox error, vbCritical
WScript.Quit
end if
end function
'把第五行filetype = ".vbs"中的.vbs 改为.bat 就能在右键的新建菜单中看增加.bat了
' this is the file extension the new command
' should generate:
filetype = ".vbs"
set WSHShell = CreateObject("WScript.Shell")
prg = ReadReg("HKCR\" & filetype & "\")
prgname = ReadReg("HKCR\" & prg & "\")
ask = "What should be the name for new VBScript scripts?"
title = "New menu entry"
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
' key could not be read: complain!
error = "Error: Registry-Key """ & key _
& """ could not be found!"
MsgBox error, vbCritical
WScript.Quit
end if
end function
