zoukankan      html  css  js  c++  java
  • VBS一些常用函数-持续更新

    以下原创信息来自http://www.cnblogs.com/zhangbo2012,转载请注明出处

    '注册服务,常用于注册第三方dll组件
    Function setup()
        dllpath = GetSelfPath & "dllmsxml.dll"
        wsh.run "regsvr32 " & dllpath & " /s"
        Wscript.sleep 1000
    End function
    
     
    '获取自身home目录全路径,常用于全路径处理时
    Function GetSelfPath()
        SelfPath = fso.GetFile(Wscript.ScriptFullName).ParentFolder.Path
        If Right(SelfPath,1) <> "" Then SelfPath=SelfPath & ""
        GetSelfPath=SelfPath
    End Function
    
    
    '格式化输出时间 yyyymmddhh24misss,直接反馈14位的时间,如20130218121500
    Function Formattime()
        Formattime = year(date) & string(2-len(month(date)),"0") & month(date) & string(2-len(day(date)),"0") & day(date) & string(2-len(hour(time)),"0") & hour(time) & string(2-len(Minute(time)),"0") & Minute(time) & string(2-len(Second(time)),"0") & Second(time)
    End Function
    
    
    '结束进程
    Function EndProcess(processname)
        Set WMI_Obj = GetObject("winmgmts:\.
    ootcimv2").ExecQuery("Select * from Win32_Process", , 48)
        For each obj in WMI_Obj
            if obj.Caption = processname  then 
                obj.Terminate
            end if
        next
    End Function
    
    
    
    '读取文件行数
    Function Readfilelinecnt(filename)
        set fso = CreateObject("Scripting.Filesystemobject")
        cnt = 0
        Set rf=fso.opentextfile(filename,1)  
        do while rf.atendofstream=0
            tempstr=rf.readline
            cnt=cnt+1
        loop
        rf.close
        Readfilelinecnt = cnt
    End Function

    以上原创信息来自http://www.cnblogs.com/zhangbo2012,转载请注明出处

     

    '定时
    start_time    = "2014/03/15 02:45" 
    call  sleepto(start_time)
    Function sleepto (d)
        sleeputil = 10*1000
        do 
            st = datediff("s",now,d)
            if st<20 then sleeputil=1*1000
            if st > 0 then 
                wscript.sleep sleeputil
                else
                exit do
            end if     
        loop
    End Function

    以上原创信息来自http://www.cnblogs.com/zhangbo2012,转载请注明出处

  • 相关阅读:
    多点触摸时代来了,第一个是什么呢
    能看出点幻影刺客的风采
    XNA 贴图载入的新状况
    WAR3的模型,幻影刺客,我来了。
    幻影刺客跑起来啦
    TM2T入手
    哥们儿,你终于来了….哈哈,等的花儿都谢了。
    鸣谢 MAGOSX.com
    彩色版幻影刺客留念
    好吧,效果先到这里吧
  • 原文地址:https://www.cnblogs.com/zhangbo2012/p/3592670.html
Copyright © 2011-2022 走看看