zoukankan      html  css  js  c++  java
  • 中国菜刀批量导出数据

    scripthost = wscript.fullname
    scripthost = right(scripthost, 11)
    if not (ucase(scripthost) = "CSCRIPT.EXE") then
    set ws=Create("wscript.shell")
    ws.run "cscript /nologo "&""""&wscript.scriptfullname&""""
    wscript.quit
    end if
    set args = wscript.arguments
    if args.count<>3 then
    call help
    end if
    set conn =CreateObject("ADODB.Connection")
    pwd="密"&chr(13)&chr(9)&chr(10)&"码"&chr(2)
    connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & args(1)&" ;Mode=Share Deny Read|Share Deny Write;Persist Security Info=False;Jet OLEDB:Database Password="&pwd&";"
    conn.open connstr
    set fso=CreateObject("scripting.filesystemobject")
    if(args(0)="/i") then
    call import
    else
    call export
    end if
    conn.close
    set fso=nothing
    set conn=nothing
    wscript.echo "done"
    
    function help()
    wscript.echo "chopper export/import tool by zcgonvh"
    wscript.echo "usage: cscript "&wscript.scriptname&" </e|/i> MDB TXT"
    wscript.echo "/e:export to text"
    wscript.echo "/i:import from text"
    wscript.quit
    end function
    
    function export()
    set optfile=fso.opentextfile(args(2),8,true)
    set rs =CreateObject("ADODB.RecordSet")
    rs.Open "select * from SITE",conn,1,1
    do while not rs.eof
    tmptext=rs("siteurl") &chr(9)& rs("sitepass") &chr(9)& rs("ntype")&chr(9)& rs("ncodepage")&chr(9)
    select case rs("nscript")
    case 0:tmptext=tmptext&"php"
    case 1:tmptext=tmptext&"aspx"
    case 2:tmptext=tmptext&"asp"
    case else:tmptext=tmptext&"customize"
    end select
    optfile.writeline tmptext
    rs.movenext
    loop
    rs.close
    optfile.close
    set optfile=nothing
    set rs=nothing
    end function
    
    function import()
    Set optfile=fso.opentextfile(args(2),1)
    do while not optfile.atendofstream
    tmparr = split(optfile.readline,chr(9))
    sql="insert into SITE(siteurl,sitepass,ntype,ncodepage,nscript) values("""&tmparr(0)&""","""&tmparr(1)&""","&tmparr(2)&","&tmparr(3)&","
    select case lcase(tmparr(4))
    case "php":sql=sql&"0)"
    case "aspx":sql=sql&"1)"
    case "asp":sql=sql&"2)"
    case else:sql=sql&"3)"
    end select
    conn.execute(sql)
    loop
    set optfile = nothing
    end function

    用法:

    将db.mdb中数据导出至export.txt
    cscript export.vbs /e db.mdb export.txt
    将export.txt导入db.mdb
    cscript export.vbs /i db.mdb export.txt

    各种语言的密码:

    "密"&chr(13)&chr(9)&chr(10)&"码"&chr(2)
    byte pwd[]={0xc3,0xdc,0x0d,0x09,0x0a,0xc2,0xeb,0x02};(char*)pwd
    Encoding.GetEncoding(936).GetString(new byte[]{0xc3,0xdc,0x0d,0x09,0x0a,0xc2,0xeb,0x02})

    64位的系统需要用下面命令

    %windir%SysWoW64cmd.exe /c cscript exp.vbs /e db.mdb export.txt
  • 相关阅读:
    JQuery MultiSelect(左右选择框)
    jquery隐藏table表格的某一列
    JS刷新页面的几种方法
    jQuery对select操作小结
    更新数据前jquery如何填充数据到表单域中
    hibernate中load和get方法的区别
    java项目常用 BaseDao BaseService
    js判断360浏览器 兼容模式IE版本
    vue 文本比较插件
    vue问题总结
  • 原文地址:https://www.cnblogs.com/hookjoy/p/4400907.html
Copyright © 2011-2022 走看看