明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2787|回复: 11

返回本次系统开机时间

[复制链接]
发表于 2013-2-8 19:51 | 显示全部楼层 |阅读模式
(defun C:GetLogTime (/ $GetLogDir DIR FLAG FN STR STRT TIME UDIR)
  (defun $GetLogDir (/ DIR FILE FN KEY STR VAL)
  (setq fn "c:\\tmp.txt")
  (vl-cmdf "_.Shell" (strcat "echo %systemroot% >" fn))
  (setq file (open fn "r"))
  (setq str (read-line file))
  (close file)
  (vl-file-delete fn)
  (setq key "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\SchedulingAgent")
  (setq val (cdr (vl-registry-read key "LogPath")));属可扩充字符串值返回点表形式
  (setq dir (vl-string-subst
       (strcase (vl-string-trim " " str))
       (strcase "%systemroot%")
       (strcase val)
     )
  )
  (findfile dir)
)
  
  (cond
    ((setq Udir ($GetLogDir))
     (setq dir "c:\\ansi.txt")
     (vl-cmdf "_.shell" (strcat "type " Udir " > " dir))
     (setq fn (open dir "r")
    Flag T
     )
     (while (And Flag (setq str (read-line fn)))
       (if (vl-string-search "已启动于" str)
  (setq StrT str)
       )
       (if (vl-string-search "在这条线以上的是最新输入项" str)
  (setq Time (substr StrT 11)
        Flag Nil
  )
       )
     )
     (close fn)
     (vl-file-delete dir)
     Time
    )
    (T nil)
  )
)





此函数返回操作系统本次机关时间,不足之处是程序两次调用SHELL,屏幕会闪两次。欢迎高手来解决此问题哦


该贴已经同步到 zark的微博
发表于 2013-2-8 21:29 | 显示全部楼层
; 错误: 参数类型错误: consp "C:\\WINDOWS\\SchedLgU.Txt"
(setq val (vl-registry-read key "LogPath")) 这里出错了,因为不知道原理所以不会修正
 楼主| 发表于 2013-2-8 22:16 | 显示全部楼层
xsso 发表于 2013-2-8 21:29
; 错误: 参数类型错误: consp "C:\\WINDOWS\\SchedLgU.Txt"
(setq val (vl-registry-read key "LogPath")) ...

命令: GetLogTime
_.Shell
OS Command: echo %systemroot% >c:\tmp.txt
命令: _.shell
OS Command: type C:\WINDOWS\TASKS\SCHEDLGU.TXT > c:\ansi.txt
命令: "2013/2/8 19:26:08"
发表于 2013-3-1 11:54 | 显示全部楼层
能不能用呀???
发表于 2013-3-2 14:04 | 显示全部楼层
本帖最后由 sunny20102 于 2013-3-2 15:24 编辑

Highflybird有个帖子关于ActiveX的,你找下,应该能找到
注意    "Win32_OperatingSystem" 此进程里面BootUpTime


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2013-3-25 15:47 | 显示全部楼层
发表于 2013-3-25 15:47 | 显示全部楼层
发表于 2013-3-25 17:09 | 显示全部楼层
為什麼禁止發言還能發言?
发表于 2013-3-26 05:35 | 显示全部楼层
发表于 2013-3-26 08:38 | 显示全部楼层
5楼能否详解一下呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-4 07:29 , Processed in 0.288300 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表