日期:2009-09-10  浏览次数:20834 次

将下面的内容保存成.vbs文件,然后双击执行,在打开ie页面,在页面中点击右键,看看菜单中多了个什么!!:)


    Option Explicit

    
    dim hkey_root,hkey_path,hkey_key,filePath
    dim fs,fso,RegWsh

    hkey_root="HKEY_CURRENT_USER"
    hkey_path="\Software\Microsoft\Internet Explorer"

    '//先创建文件
    set fs=Wscript.CreateObject("Scripting.FileSystemObject")
    filePath="C:\pagesetup_default.htm"
    set fso=fs.CreateTextFile(filePath,true)
    fso.write("<script language=""VBScript"">"+vbcrlf _
            +"dim hkey_root,hkey_path,hkey_key,filePath,RegWsh" +vbcrlf _
            +"hkey_root=""HKEY_CURRENT_USER""" +vbcrlf _
            +"hkey_path=""\Software\Microsoft\Internet Explorer""" +vbcrlf _
            +"filePath=""C:\pagesetup_null.htm""" +vbcrlf _
            +"'//设置网页打印的页眉页脚为默认值"+vbcrlf  _
            +"Set RegWsh = CreateObject(""WScript.Shell"")" +vbcrlf _
            +"hkey_key=""\PageSetup\header""" +vbcrlf _
            +"RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""&w&b页码:&p/&P""" +vbcrlf _
            +"hkey_key=""\PageSetup\footer""" +vbcrlf _
            +"RegWsh.RegWrite hkey_root+hkey_path+hkey_key,""&u&b&d""" +vbcrlf _
            +"'//设置右键菜单上的显示文字" +vbcrlf _
            +"'//首先删除原来的项,然后再设置新的项"+vbcrlf  _
            +"on error resume next" +vbcrlf _
            +"hkey_key=hkey_root+hkey_path+""\MenuExt\打印时恢复页眉页脚\""" +vbcrlf _
            +"RegWsh.RegDelete hkey_key" +vbcrlf _
            +"hkey_key=hkey_root+hkey_path+""\MenuExt\打印时去掉页眉页脚\""" +vbcrlf _
            +"RegWsh.RegWrite hkey_key,filePath" +vbcrlf _
            +"'//关闭RegWsh" +vbcrlf _
            +"set RegWsh=nothing"+vbcrlf  _
        +"</script>")
    fso.close

    filePath=&qu