明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1800|回复: 7

[求助]请问哪位高手知道如何改文件名:把“C:\\AA.txt”改成"BB.txt"

[复制链接]
发表于 2008-10-1 23:39:00 | 显示全部楼层 |阅读模式

请问哪位高手知道如何改文件名:

把“C:\\AA.txt”改成"BB.txt"

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2008-10-2 08:56:00 | 显示全部楼层

(vl-file-rename old-filename new-filename)

Examples
_$ (vl-file-rename "c:/newauto.bat" "c:/myauto.bat")

 楼主| 发表于 2008-10-2 22:04:00 | 显示全部楼层
非常感谢Andyhon!还有就是问一下,如何判断c:\\下有没有“newauto.ini”没有则新建,并在“newauto.ini”中写入“(command "-style" "宋体" "宋体" 0.00 0.8 0 "n" "n" "n")”呢?
发表于 2008-10-2 22:18:00 | 显示全部楼层
open一下试试,打不开就说明没有
 楼主| 发表于 2008-10-2 22:26:00 | 显示全部楼层
可不可以写个完整一点的?
发表于 2008-10-3 00:04:00 | 显示全部楼层

DosLib内有法现成的函数

DosLib:
http://download.rhino3d.com/download.asp?id=doslib


dos_filep
--------------------------------------------------------------------
Returns the existence of a file.

Syntax
(dos_filep filename)
Parameters
filename
 The source filename.

Returns
T if filename exists.

nil if filename does not exist, or on error.

Example
Command: (dos_filep "c:\\program files\\autocad 2002\\drawing1.dwg")
T

Command: (dos_filep "c:\\program files\\autocad 2002\\drawing3.dwg")
nil

发表于 2008-10-3 19:28:00 | 显示全部楼层

DosLib 很不错,但是我从来没用过,个人认为用VL能基本解决文件和目录的操作。

这样打包成的VLX可以在没有 DosLib 上的机子运行。

发表于 2008-10-6 06:38:00 | 显示全部楼层

(if(not(findfile "c:\\newauto.ini"))

(progn

(setq fw(open "c:\\newauto.ini" "w"))

...

)

)

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-11-8 04:03 , Processed in 0.143388 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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