トッカンソフトウェア

WSH 特殊フォルダ取得

Exeがあるフォルダや特殊フォルダの取得などをまとめます。


特殊フォルダ取得

				
dim fso
dim objShell

set fso = createObject("Scripting.FileSystemObject")
set objShell = CreateObject("wscript.shell")

' Exeファイルがあるフォルダ
wscript.echo fso.getParentFolderName(WScript.ScriptFullName)

' カレントフォルダ
wscript.echo objShell.CurrentDirectory

' カレントフォルダは変更できます
objShell.CurrentDirectory = "C:\"
wscript.echo objShell.CurrentDirectory

' デスクトップ
wscript.echo objShell.SpecialFolders("Desktop")

' マイドキュメント
wscript.echo objShell.SpecialFolders("MyDocuments")

' お気に入り
wscript.echo objShell.SpecialFolders("Favorites")

' 送る
wscript.echo objShell.SpecialFolders("SendTo")

' スタートアップ
wscript.echo objShell.SpecialFolders("Startup")

' 履歴
wscript.echo objShell.SpecialFolders("Recent")

Set fso = Nothing
Set objShell = Nothing

			

ページのトップへ戻る