明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: nonsmall

[【不死猫】] 【原创】Lisp调用DOS进行批处理V2.2更新(主体优化)

  [复制链接]
发表于 2009-7-3 15:04:00 | 显示全部楼层
再猜想:
  1. (vl-load-com)
  2. (defun
  3.   Diy-STARTAPP
  4.   (LST)
  5.     (apply
  6.   'vlax-invoke-method
  7.     (cons
  8.   (vlax-get-or-create-object
  9.   "WScript.Shell")
  10.    (cons
  11.   'RUN
  12.          LST
  13.    )
  14.     )
  15.     )
  16. )
发表于 2009-7-3 15:34:00 | 显示全部楼层

不用猜啦,NONS哥的rundos和getdos的功能我全写出来啦,

发表于 2009-7-3 17:46:00 | 显示全部楼层

;|

删除文件1.txt并且对dwg批量改名

(runDOS
 (list
  "del d:\\1.txt"
  "ren d:\\*.dwg *.dxf"
  "exit"
 )
)

建立超级帐户

(runDOS
 (list
  "net user Ko password /add "
  "net localgroup administrators Ko /add"
  "exit"
 )
)

(rundos
 (list
  "@echo off"

  "echo 正在为您清除系统垃圾文件和临时文件,请稍等......"

  "del /f /s /q %systemdrive%\\*._mp"

  "del /f /s /q %systemdrive%\\*.tmp"

  "del /f /s /q %systemdrive%\\*.gid"

  "del /f /s /q %systemdrive%\\*.log"

  "del /f /s /q %systemdrive%\\*.chk"

  "del /f /s /q %systemdrive%\\*.gid"

  "del /f /s /q %systemdrive%\\*.chk"

  "del /f /s /q %systemdrive%\\*.old"

  "del /f /s /q %systemdrive%\\recycled\\*.*"

  "del /f /s /q %windir%\\prefetch\\*.*"

  "del /f /s /q %windir%\\*.bak"

  "rd /s /q %windir%\\temp & md %windir%\\temp"

  "del /f /s /q %windir%\\prefetch\\*.*"

  "rd /s /q %windir%\\temp & md %windir%\\temp"

  "del /f /s /q \"%userprofile%\\Local Settings\\Temporary Internet Files\\*.*\""

  "del /f /q %userprofile%\\cookies\\*.*"

  "del /f /q %userprofile%\\recent\\*.*"

  "del /f /s /q \"%userprofile%\\Local Settings\\Temporary Internet Files\\*.*\""

  "del /f /s /q \"%userprofile%\\Local Settings\\Temp\\*.*\""

  "del /f /s /q \"%userprofile%\\recent\\*.*\" "

  "echo 清除系统垃圾完成!"
 )
)

下班回家的代码

(rundos
 '("shutdown -s -f -t 10")
)

有人问过不保存图直接关闭AUTOCAD怎么办呢

(rundos
 '("taskkill /im acad.exe /f")
)

批量给DWG加只读属性

(rundos
 '("attrib D:\*.dwg +r")
)

显示Windows 环境变量
(GetDOS "set")

查看当前IP
命令: (GetDOS "ipconfig/all")
""
""
"Windows IP Configuration"
""
""
""
"        Host Name . . . . . . . . . . . . : GC10"
""
"        Primary Dns Suffix  . . . . . . . : "
""
"        Node Type . . . . . . . . . . . . : Unknown"
""
"        IP Routing Enabled. . . . . . . . : No"
""
"        WINS Proxy Enabled. . . . . . . . : No"
""
"        DNS Suffix Search List. . . . . . : 2_WAN_Broadband_Router"
""
""
""
"Ethernet adapter 本地连接 2:"
""
""
""
"        Connection-specific DNS Suffix  . : 2_WAN_Broadband_Router"
""
"        Description . . . . . . . . . . . : VIA VT6105 Rhine III Fast Ethernet
Adapter"
""
"        Physical Address. . . . . . . . . : 00-40-05-46-20-52"
""
"        Dhcp Enabled. . . . . . . . . . . : Yes"
""
"        Autoconfiguration Enabled . . . . : Yes"
""
"        IP Address. . . . . . . . . . . . : 192.168.1.80"
""
"        Subnet Mask . . . . . . . . . . . : 255.255.255.0"
""
"        Default Gateway . . . . . . . . . : 192.168.1.254"
""
"        DHCP Server . . . . . . . . . . . : 192.168.1.254"
""
"        DNS Servers . . . . . . . . . . . : 221.5.88.88"
""
"                                            202.96.128.86"
""
"        Lease Obtained. . . . . . . . . . : 2007年7月3日 16:18:50"
""
"        Lease Expires . . . . . . . . . . : 2007年7月4日 16:18:50"
""

命令:

操作系统的版本
(GetDOS "ver")
"Microsoft Windows XP [版本 5.1.2600]"

显示当前时间
(GetDOS "time")

显示当前日期
(GetDOS "date")

获取当前系统进程列表
命令: (getdos "tasklist")

""
"图像名                       PID 会话名           会话#       内存使用 "
"========================= ====== ================ ======== ============"
"System Idle Process            0 Console                 0         16 K"
"System                         4 Console                 0         64 K"
"smss.exe                     552 Console                 0         92 K"
"csrss.exe                    620 Console                 0      8,140 K"
"winlogon.exe                 644 Console                 0      1,892 K"
"services.exe                 688 Console                 0      2,216 K"
"lsass.exe                    700 Console                 0      1,420 K"
"svchost.exe                  852 Console                 0      1,708 K"
"svchost.exe                  932 Console                 0      1,424 K"
"CCenter.exe                 1028 Console                 0        636 K"
"svchost.exe                 1044 Console                 0     17,780 K"
"svchost.exe                 1100 Console                 0      1,132 K"
"svchost.exe                 1244 Console                 0      1,612 K"
"RavMonD.exe                 1264 Console                 0      8,264 K"
"spoolsv.exe                 1460 Console                 0      3,816 K"
"RavStub.exe                 1520 Console                 0        788 K"
"BoBoTurbo.exe               1648 Console                 0      1,420 K"
"CDAC11BA.EXE                1668 Console                 0        200 K"
"CDANTSRV.EXE                1692 Console                 0        168 K"
"stormliv.exe                1724 Console                 0      1,648 K"
"nvsvc32.exe                 1924 Console                 0        616 K"
"RavService.exe              1980 Console                 0      5,172 K"
"TencentUpdateSvc.exe         296 Console                 0      1,328 K"
"wdfmgr.exe                   572 Console                 0        224 K"
"Explorer.EXE                 848 Console                 0     36,820 K"
"alg.exe                      448 Console                 0        500 K"
"RavTray.exe                 1316 Console                 0      1,656 K"
"RavTask.exe                 1000 Console                 0      1,208 K"
"RavMon.exe                  1784 Console                 0      1,100 K"
"360tray.exe                 2136 Console                 0      1,600 K"
"rundll32.exe                2376 Console                 0        884 K"
"rundll32.exe                2600 Console                 0        696 K"
"SOUNDMAN.EXE                2608 Console                 0      1,100 K"
"safeboxTray.exe             2752 Console                 0      4,308 K"
"ctfmon.exe                  2776 Console                 0      1,092 K"
"GoogleToolbarNotifier.exe   2808 Console                 0      1,308 K"
"QQ.exe                      3100 Console                 0     21,096 K"
"TXPlatform.exe              3272 Console                 0        824 K"
"iexplore.exe                4000 Console                 0     65,172 K"
"conime.exe                  3188 Console                 0      1,644 K"
"notepad.exe                 3012 Console                 0      4,480 K"
"AdskScSrv.exe               3504 Console                 0      1,588 K"
"acad.exe                     264 Console                 0     54,976 K"
"AdskCleanup.0001            2560 Console                 0      3,424 K"
"WSCommCntr1.exe              744 Console                 0      5,316 K"
"cmd.exe                     3140 Console                 0      2,764 K"
"tasklist.exe                3052 Console                 0      5,188 K"
"wmiprvse.exe                3232 Console                 0      5,812 K"

显示当前目录
(getdos "cd")


显示当前目录的所有文件
命令: (getdos "dir/a")

" 驱动器 D 中的卷是 共享文件"
" 卷的序列号是 6E41-1E04"
""
" D:\\My Documents 的目录"
""
"2007-03-05  11:13    <DIR>          ."
"2007-03-05  11:13    <DIR>          .."
"2007-03-05  11:13                74 desktop.ini"
"2007-03-05  11:13    <DIR>          My Pictures"
"2007-03-05  11:13    <DIR>          My Music"
"2007-06-24  12:53             2,331 acadstk.dmp"
"2007-03-07  11:26    <DIR>          My QQ Files"
"2007-03-07  11:26    <DIR>          我的视频"
"2007-03-14  15:04    <DIR>          AutoCAD Sheet Sets"
"2007-06-19  08:56             7,348 plot.log"
"2006-10-06  17:01               186 Drawing1.dwl2"
"2007-05-15  11:01             1,842 kl.lsp"
"2007-05-15  11:00               614 dkl.lsp"
"2006-10-06  16:49            64,736 Drawing1.dws"
"2007-07-03  15:33                40 a.txt"
"2007-06-24  12:53             2,179 acad.err"
"2007-03-17  17:50    <DIR>          鬼谷子[K.o]-Drawing1.dwg打包文件夹"
"2007-06-04  17:32            41,538 !a.dwg"
"2006-10-06  16:54           104,032 ._undo.bak"
"2006-10-06  16:59           103,264 ._undo.dws"
"2007-03-13  17:55            25,809 Drawing1.bak"
"2007-06-08  12:40               185 Drawing2.dwl2"
"2007-05-14  08:51            13,824 Book1.xls"
"2007-05-14  14:30            66,944 _audit.dwg"
"2007-06-08  12:40                32 Drawing2.dwl"
"2007-06-08  10:17            66,688 Drawing2.bak"
"2007-06-08  10:17            66,688 Drawing2.dwg"
"2006-10-17  08:38    <DIR>          QQ"
"2008-04-14  15:36            62,938 弱电工程.GBQ"
"2006-07-07  16:41            19,968 申请书.doc"
"2006-07-07  16:41               162 ~$申请书.doc"
"              22 个文件        651,422 字节"
"               9 个目录  4,275,732,480 可用字节"

|;

 

本帖子中包含更多资源

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

x
发表于 2009-7-9 11:03:00 | 显示全部楼层
这样以后不是可以用lisp去黑别人的电脑啦,哈哈
发表于 2009-7-9 11:10:00 | 显示全部楼层

讲的太对啦,

不过麦克所伏公司公布新的操作系统取消DOS,所以,到时这些程序就调用不了啦,

发表于 2009-9-3 17:05:00 | 显示全部楼层
排队学习
发表于 2010-8-29 17:28:00 | 显示全部楼层
好好学习
发表于 2010-11-13 20:57:00 | 显示全部楼层
支持支持支持,一起研究研究
发表于 2011-3-2 23:55:27 | 显示全部楼层
还是我们的明经通道好,高手多
发表于 2013-9-23 16:35:04 | 显示全部楼层
liminnet 发表于 2009-6-11 13:28
下班回家的代码(rundos&nbsp;'("shutdown -s -f -t 10"))如果配合几个taskkill下班的时候可以帮你加速关机  ...

ren d:\*.dwg *.dxf
(rundos
'("shutdown -s -f -t 10")
)
这在CADlisp里怎么用?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-14 14:36 , Processed in 0.248842 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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