找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 396|回复: 2

[每日一码] 获取系统路径

[复制链接]

已领礼包: 20个

财富等级: 恭喜发财

发表于 2021-1-16 18:39:56 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×

  1. (defun _GetSpecialFolder ( int / fso fob res )
  2.     (vl-catch-all-apply
  3.        '(lambda nil
  4.             (setq fso (vlax-create-object "Scripting.FileSystemObject")
  5.                   fob (vlax-invoke-method fso 'getspecialfolder int)
  6.                   res (vlax-get-property fob 'path)
  7.             )
  8.         )
  9.     )
  10.     (if fob (vlax-release-object fob))
  11.     (if fso (vlax-release-object fso))
  12.     res
  13. )


命令: (_GETSPECIALFOLDER 1)
"C:\\Windows\\System32"

命令: (_GETSPECIALFOLDER 2)
"C:\\Users\\DSJFWZ~1\\AppData\\Local\\Temp"

目录路径详见:
Reference
Arguments
  • object
    Required. Always the name of a FileSystemObject.
  • folderspec
    Required. The name of the special folder to be returned. Can be any of the constants shown in the Settings section.

Settings
The folderspec argument can have any of the following values:
SETTINGS
Constant
Value
Description

WindowsFolder
0
The Windows folder contains files installed by the Windows operating system.

SystemFolder
1
The System folder contains libraries, fonts, and device drivers.

TemporaryFolder
2
The Temp folder is used to store temporary files. Its path is found in the TMP environment



论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 1094个

财富等级: 财源广进

发表于 2021-1-22 06:04:10 | 显示全部楼层
获取系统路径,感谢分享!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2022-6-9 11:07:43 | 显示全部楼层
看到好贴必点赞,感谢分享!
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-4-16 18:34 , Processed in 0.324057 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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