2
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ランタイムエラー(59、1):オブジェクトはこのプロパティまたはメソッドをサポートしていません:'objShell.SpecialFolders'

*スクリプトが完了しました-終了コード:259 *

http://www.wisesoft.co.uk/scripts/vbscript_display_special_folder_locations.aspxを参照として使用しました。

4

1 に答える 1

3

ObjShellの場合、実装されているものにWScript.Shellアクセスできますが、実装されていないSpecialFoldersインスタンスに再割り当てすると、エラーが発生します。Shell.ApplicationSpecialFolders

strCurrentDirectory = objShell.SpecialFolders("AllUsersDesktop")

パスを取得してから、次のようにします。

Set objFolder = objShell.Namespace(strCurrentDirectory)

たとえば、その後、シェルアイテムとしてフェッチします。

msgbox objFolder.Title

エコーします"Desktop"

于 2011-05-20T15:07:28.833 に答える