vbscript 通过什么命令修改windows系统时间?只有通过cmd吗?

解决方案 »

  1.   

    修改系统时间可以用API函数SetSystemTime。或者: 
    Private Type SYSTEMTIME
        wYear  As Integer
        wMonth  As Integer
        wDayOfWeek  As Integer
        wDay  As Integer
        wHour  As Integer
        wMinute  As Integer
        wSecond  As Integer
        wMilliseconds  As Integer
    End TypePrivate Declare Function SetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
      

  2.   

    请问楼上的vbs能用api 么?
        你觉得这样符合你的要求么 ?
             date=#2/12/2008#
            time=#2:00:00 am#
      

  3.   

    SetSystemTime     
        
      VB声明     
      Declare   Function   SetSystemTime   Lib   "kernel32"   Alias   "SetSystemTime"   (lpSystemTime   As   SYSTEMTIME)   As   Long     
      说明     
      设置当前系统时间     
      返回值     
      Long,非零表示成功,零表示失败。会设置GetLastError     
      参数表     
      参数   类型及说明     
      lpSystemTime   SYSTEMTIME,这个结构指定了新的地方时间。其中的wDayOfWeek条目会被忽略     
        
      ====================================================================   
      SYSTEMTIME     
        
      类型定义     
      Type   SYSTEMTIME   '   16   Bytes     
      wYear   As   Integer   
      wMonth   As   Integer   
      wDayOfWeek   As   Integer   
      wDay   As   Integer   
      wHour   As   Integer   
      wMinute   As   Integer   
      wSecond   As   Integer   
      wMilliseconds   As   Integer   
      End   Type     
      说明     
      This   structure   contains   date   and   time   information.   
          
      字段表     
      字段   类型与说明     
      wYear   Integer,The   current   year.     
      wMonth   Integer,The   current   month.   January   is   1.     
      wDayOfWeek   Integer,The   current   day   of   the   week.   Sunday   is   0.     
      wDay   Integer,The   current   day   of   the   month.     
      wHour   Integer,The   current   hour.     
      wMinute   Integer,The   current   minute.     
      wSecond   Integer,The   current   second.     
      wMilliseconds   Integer,The   current   millisecond.