在 Select 文件夹对话框中禁用 "Make new folder"
Disable "Make new folder" in Select Folder Dialog
我正在制作一个脚本,该脚本使用下面的对话框 select 这个 运行 命令所在的文件夹问题是没有必要作为创建新文件夹的选项。 .. 我想知道如何删除 "make new folder"?
我的代码:
Option Explicit
Dim strPath
strPath = SelectFolder( "" )
If strPath = vbNull Then
WScript.Echo "Cancelled"
Else
WScript.Echo "Selected Folder: """ & strPath & """"
End If
Function SelectFolder( myStartFolder )
' Standard housekeeping
Dim objFolder, objItem, objShell
' Custom error handling
On Error Resume Next
SelectFolder = vbNull
' Create a dialog object
Set objShell = CreateObject( "Shell.Application" )
Set objFolder = objShell.BrowseForFolder( 0, "Select Folder", 1, myStartFolder )
' Return the path of the selected folder
If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
' Standard housekeeping
Set objFolder = Nothing
Set objshell = Nothing
On Error Goto 0
End Function
如有疑问,请阅读 the documentation:
BIF_NONEWFOLDERBUTTON (0x00000200)
0x00000200. Version 6.0. Do not include the New Folder button in the browse dialog box.
将 0x200 添加到选项参数中:
Set objFolder = objShell.BrowseForFolder(0, "Select Folder", <b>&h201</b>, myStartFolder)
我正在制作一个脚本,该脚本使用下面的对话框 select 这个 运行 命令所在的文件夹问题是没有必要作为创建新文件夹的选项。 .. 我想知道如何删除 "make new folder"?
我的代码:
Option Explicit
Dim strPath
strPath = SelectFolder( "" )
If strPath = vbNull Then
WScript.Echo "Cancelled"
Else
WScript.Echo "Selected Folder: """ & strPath & """"
End If
Function SelectFolder( myStartFolder )
' Standard housekeeping
Dim objFolder, objItem, objShell
' Custom error handling
On Error Resume Next
SelectFolder = vbNull
' Create a dialog object
Set objShell = CreateObject( "Shell.Application" )
Set objFolder = objShell.BrowseForFolder( 0, "Select Folder", 1, myStartFolder )
' Return the path of the selected folder
If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
' Standard housekeeping
Set objFolder = Nothing
Set objshell = Nothing
On Error Goto 0
End Function
如有疑问,请阅读 the documentation:
BIF_NONEWFOLDERBUTTON (0x00000200)
0x00000200. Version 6.0. Do not include the New Folder button in the browse dialog box.
将 0x200 添加到选项参数中:
Set objFolder = objShell.BrowseForFolder(0, "Select Folder", <b>&h201</b>, myStartFolder)