找回密码
 加入
搜索
查看: 2319|回复: 7

请问如何获取当前的盘符?

[复制链接]
发表于 2008-11-21 16:38:53 | 显示全部楼层 |阅读模式
获取脚本所在路径的盘符怎么弄啊?
@ScriptDir获取的是整个路径。。。。  
另外想问下  一次执行多个相同的动作,比如说复制多个不同的文件, 有没有更简洁的命令?

[ 本帖最后由 entadywand 于 2008-11-21 18:40 编辑 ]
发表于 2008-11-21 17:10:15 | 显示全部楼层
$array = stringsplit(@scriptdir,"\")
msgbox("","",$array[1])

[ 本帖最后由 netegg 于 2008-11-21 17:14 编辑 ]
发表于 2008-11-21 17:15:53 | 显示全部楼层
第二个问题没明白要干什么
 楼主| 发表于 2008-11-21 17:41:10 | 显示全部楼层
谢谢楼上 第2个就是就是比方说我要复制10个文件到不同的目录
filecopy 这个命令是不是要写10行啊?》
发表于 2008-11-21 17:42:10 | 显示全部楼层
多个不同文件可使用通配符:
FileCopy("C:\*.au3", "D:\mydir\*.*")

; Method to copy a folder (with its contents)
DirCreate("C:\new")
FileCopy("C:\old\*.*", "C:\new\")

FileCopy("C:\Temp\*.txt", "C:\Temp\TxtFiles\", 8)
; RIGHT - 'TxtFiles' is now the target directory and the file names are given by the source names

FileCopy("C:\Temp\*.txt", "C:\Temp\TxtFiles\", 9) ; Flag = 1 + 8 (overwrite + create target directory structure)
; Copy the txt-files from source to target and overwrite target files with same name


或者用:
FileFindFirstFile  ()
FileFindNextFile  ()
发表于 2008-11-21 17:56:08 | 显示全部楼层
原帖由 entadywand 于 2008-11-21 17:41 发表
谢谢楼上 第2个就是就是比方说我要复制10个文件到不同的目录
filecopy 这个命令是不是要写10行啊?》

用FOR...NEXT
DIM $FILE[10]=['A.EXE';'B.EXE';...],$TO[10]=['C:\A.EXE';'D:\B.EXE';...]
FOR $I=0 TO 9
FILECOPY($FILE[$I], $TO[$I])
NEXT
 楼主| 发表于 2008-11-21 18:39:24 | 显示全部楼层
谢谢楼上各位!
发表于 2012-7-23 00:51:26 | 显示全部楼层
谢谢这个获取盘符,为什么au3不内置这个函数呢?既然可以获取卷标。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-30 05:25 , Processed in 0.076154 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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