在"选择文件夹"对话框中禁用"创建新文件夹"

Hum*_*tas 0 vbscript

我正在创建一个脚本,使用下面的对话框选择此运行命令问题的文件夹,它不是创建新文件夹的选项...我想知道如何删除"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
Run Code Online (Sandbox Code Playgroud)

Ans*_*ers 6

如有疑问,请阅读 文档:

BIF_NONEWFOLDERBUTTON(0x00000200)

0x00000200.版本6.0.不要在浏览对话框中包含" 新建文件夹"按钮.

将0x200添加到options参数:

Set objFolder = objShell.BrowseForFolder(0, "Select Folder", &h201, myStartFolder)
Run Code Online (Sandbox Code Playgroud)