gpt4 book ai didi

file - vbs 所有用户桌面文件夹

转载 作者:行者123 更新时间:2023-12-04 06:25:35 25 4
gpt4 key购买 nike

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
strCurrentDirectory = objShell.SpecialFolders("AllUsersDesktop")
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(strCurrentDirectory)
Set objFolderItem = objFolder.Self
strCurrentDirectory = objShell.SpecialFolders("AllUsersDesktop")

脚本在最后一行崩溃

错误信息是

Microsoft VBScript runtime error (59, 1) : Object doesn't support this property or method: 'objShell.SpecialFolders'

* script completed - exit code: 259 *



我用了 http://www.wisesoft.co.uk/scripts/vbscript_display_special_folder_locations.aspx作为引用。

最佳答案

ObjShellWScript.Shell您可以访问其实现的SpecialFolders但是您随后将其重新分配给实例 Shell.Application未实现 SpecialFolders ,因此错误。

strCurrentDirectory = objShell.SpecialFolders("AllUsersDesktop")

检索路径,然后:
Set objFolder = objShell.Namespace(strCurrentDirectory)

将其作为 shell 项获取,例如之后:
msgbox objFolder.Title

会回显 "Desktop"

关于file - vbs 所有用户桌面文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6073728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com