使用FileSystemObject时,您可以使用路径".“引用运行脚本的目录。是否可以更改FileSystemObject认为是当前目录的内容,以便您可以使用“。其他目录的路径语法?
示例:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFolder(".") ' Returns the current directory
Set f2 = fso.GetFolder(".\backup") ' Returns the "backup" directory under the current directory作为一个简化的例子,有没有一种方法可以在fso上调用,这样fso.GetFolder(".")调用返回备份目录吗?
发布于 2009-10-27 15:28:30
可以使用WshShell.CurrentDirectory属性更改脚本的当前工作文件夹:
Dim oShell : Set oShell = CreateObject("WScript.Shell")
oShell.CurrentDirectory = ".\backup"这是一位“嘿,脚本男”!关于这个主题的文章:
发布于 2009-10-27 07:38:32
一般不是这样的。
但为什么不找到当前文件夹并将其存储:
Set fso = CreateObject("Scripting.FileSystemObject")
currentPath = fso.GetAbsolutePathName(".")https://stackoverflow.com/questions/1627912
复制相似问题