on error resume Next
Const MY_COMPUTER=&H11&
Const WINDOW_HANDLE=0
Const OPTIONS=0
‘设置我的电脑为根目录
Set objShell=CreateObject( "Shell.Application" )
Set objFolder=objShell. Namespace (MY_COMPUTER)
Set objFolderItem=objFolder.Self
strPath=objFolderItem.Path
Set objShell=CreateObject( "Shell.Application" )
Set objFolder=objShell.BrowseForFolder(WINDOWS_HANDLE, "选择一个文件夹:" ,OPTIONS,strPath)
If objFolder Is Nothing Then
Wscript.Quit
End If
Set objFolderItem=objFolder.Self
objPath=objFolderItem.Path
If objPath= "" Then
Wscript.Quit
Else
Wscript.Echo objPath
End If
|