How to enforce "Details" view in Windows File Select Dialog?

Page 3 of 4 FirstFirst 1234 LastLast

  1. Posts : 958
    Microsoft Windows 10 Home
       #21

    Does sl HKLM: or sl HKCU: work?
    Have you checked the permsissions on the key in regedit​?

    Please copy & paste complete text of error messages.


    rsbrux said:
    I have set up folder types Documents, Music, Pictures, Videos and General items as desired and applied to "all folders" as well as "all subfolders". Both your PowerShell script above and a simple
    Code:
    reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults
    (with or without /s) report:
    Code:
    ERROR: The system was unable to find the specified registry key or value.
    even though I can see it in the registry editor, along with the expected 5 GUID-labelled binary values. Paradoxically,
    Code:
    reg query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Streams\Desktop /s
    (with or without /s) works just fine.
    Last edited by KeithM; 18 Mar 2021 at 20:37.
      My Computer


  2. Posts : 59
    Windows 10 Pro x64 (Version 21H2, Build 19044.1415)
    Thread Starter
       #22

    Stupid mistake on my part: I was running the command and the PS script as admin, so they weren't accessing HKCU of my normal user account. I was able to run the reg query successfully in a non-privileged command window, but I couldn't run the PS script because of ExecutionPolicy restrictions. it seems that:
    Code:
    Set-ExecutionPolicy RemoteSigned
    only works in a privileged window.
    The output of reg query isn't very informative. Is there a human-readable version of the binary output? If so, how can I get it?
    This brings up another point: I would like to have the same view settings on all accounts on my laptop. Can I just export
    Code:
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults
    in my regular account and then import it in my admin account?
    Better yet, can I configure it via Group Policy?
      My Computer


  3. Posts : 958
    Microsoft Windows 10 Home
       #23

    rsbrux said:
    Stupid mistake on my part: I was running the command and the PS script as admin, so they weren't accessing HKCU of my normal user account. I was able to run the reg query successfully in a non-privileged command window, but I couldn't run the PS script because of ExecutionPolicy restrictions. it seems that:
    Code:
    Set-ExecutionPolicy RemoteSigned
    only works in a privileged window.
    I'm on a standalone machine running the Home veresion of Windows 10, so this is not my area of expertise & there really is some good documentation out there. That being said:

    • Any reason why you don't want to change it to RemoteSigned?
    • If you copy my code ino a text editor & save, I'm pretty sure it becomes your own.
    • You can copy a script as a block of text & paste directly into the console window, it's no longer
      subject to that scrutiny.
    • Check out About Execution Policies and Set-Execution Policy for starters.

    So other thatn that, I'm going to leave that up to you & please share wnat you learn. But I'll assume you figure out a way to run the code I post. Please note that rather than make this post an endless trail of breadcrumbs, I am ediiing earlier replies to flesh them out for the sake of future readers. I last updated the code early this morning.






    The output of reg query isn't very informative. Is there a human-readable version of the binary output? If so, how can I get it?
    Your talking about values under: HKCU\...\Streams\Defaults, right:
    How to  enforce "Details" view in Windows File Select Dialog?-explorer-streams-defaults-binary-regedit.png

    I've never bothered to parse them, because if you scan the hex, it's pretty evident they are binary-paced versions of the name:value pairs found in the bag of the folder that was used to define the template.
    Code:
    $Defaults = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults'
    ( gp $Defaults ).PSObject.Properties | ForEach{
        If ( $_.Name -like "{*}"  ) {
            [PSCustomObject]@{
                'Name'   = $_.Name
                'Value'  = ($Bytes = $_.Value)
                'HexText' = Format-Hex -InputObject $Bytes
            } | fl
            Read-Host 'Paused. Press <Enter> to continue.'
        }
    }
    OutPUt:
    Code:
    S C:\>>$Defaults = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults'
    >> ( gp $Defaults ).PSObject.Properties | ForEach{
    >>     If ( $_.Name -like "{*}"  ) {
    >>         [PSCustomObject]@{
    >>             'Name'   = $_.Name
    >>             'Value'  = ($Bytes = $_.Value)
    >>             'HexText' = Format-Hex -InputObject $Bytes
    >>         } | fl
    >>         Read-Host 'Paused. Press <Enter> to continue.'
    >>     }
    >> }
    >>
    
    
    Name    : {B3690E58-E961-423B-B687-386EBFD83239}
    Value   : {28, 0, 0, 0...}
    HexText : 00000000   1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
              00000010   00 00 00 00 00 00 00 00 00 00 00 00 F1 F1 F1 F1  ............
              00000020   14 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
              00000030   E8 02 00 00 E4 02 00 00 31 53 50 53 05 D5 CD D5  ......1SPS.
              00000040   9C 2E 1B 10 93 97 08 00 2B 2C F9 AE 83 00 00 00  .....+,...
              00000050   22 00 00 00 00 47 00 72 00 6F 00 75 00 70 00 42  "....G.r.o.u.p.B
              00000060   00 79 00 4B 00 65 00 79 00 3A 00 46 00 4D 00 54  .y.K.e.y.:.F.M.T
              00000070   00 49 00 44 00 00 00 08 00 00 00 4E 00 00 00 7B  .I.D.......N...{
              00000080   00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30  .0.0.0.0.0.0.0.0
              00000090   00 2D 00 30 00 30 00 30 00 30 00 2D 00 30 00 30  .-.0.0.0.0.-.0.0
              000000A0   00 30 00 30 00 2D 00 30 00 30 00 30 00 30 00 2D  .0.0.-.0.0.0.0.-
              000000B0   00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30  .0.0.0.0.0.0.0.0
              000000C0   00 30 00 30 00 30 00 30 00 7D 00 00 00 00 00 33  .0.0.0.0.}.....3
              000000D0   00 00 00 22 00 00 00 00 47 00 72 00 6F 00 75 00  ..."....G.r.o.u.
              000000E0   70 00 42 00 79 00 44 00 69 00 72 00 65 00 63 00  p.B.y.D.i.r.e.c.
              000000F0   74 00 69 00 6F 00 6E 00 00 00 13 00 00 00 01 00  t.i.o.n.........
              00000100   00 00 5B 00 00 00 0A 00 00 00 00 53 00 6F 00 72  ..[........S.o.r
              00000110   00 74 00 00 00 42 00 00 00 1E 00 00 00 70 00 72  .t...B.......p.r
              00000120   00 6F 00 70 00 34 00 32 00 39 00 34 00 39 00 36  .o.p.4.2.9.4.9.6
              00000130   00 37 00 32 00 39 00 35 00 00 00 00 00 1C 00 00  .7.2.9.5........
              00000140   00 01 00 00 00 30 F1 25 B7 EF 47 1A 10 A5 F1 02  .....0%G...
              00000150   60 8C 9E EB AC 0A 00 00 00 01 00 00 00 25 00 00  `........%..
              00000160   00 14 00 00 00 00 47 00 72 00 6F 00 75 00 70 00  ......G.r.o.u.p.
              00000170   56 00 69 00 65 00 77 00 00 00 0B 00 00 00 00 00  V.i.e.w.........
              00000180   00 00 1B 00 00 00 0A 00 00 00 00 4D 00 6F 00 64  ...........M.o.d
              00000190   00 65 00 00 00 13 00 00 00 01 00 00 00 23 00 00  .e...........#..
              000001A0   00 12 00 00 00 00 49 00 63 00 6F 00 6E 00 53 00  ......I.c.o.n.S.
              000001B0   69 00 7A 00 65 00 00 00 13 00 00 00 00 01 00 00  i.z.e...........
              000001C0   D5 00 00 00 10 00 00 00 00 43 00 6F 00 6C 00 49  ........C.o.l.I
              000001D0   00 6E 00 66 00 6F 00 00 00 42 00 00 00 1E 00 00  .n.f.o...B......
              000001E0   00 70 00 72 00 6F 00 70 00 34 00 32 00 39 00 34  .p.r.o.p.4.2.9.4
              000001F0   00 39 00 36 00 37 00 32 00 39 00 35 00 00 00 00  .9.6.7.2.9.5....
              00000200   00 90 00 00 00 FD DF DF FD 10 00 00 00 00 00 00  ...........
              00000210   00 00 00 00 00 05 00 00 00 18 00 00 00 30 F1 25  .............0%
              00000220   B7 EF 47 1A 10 A5 F1 02 60 8C 9E EB AC 0A 00 00  G...`...
              00000230   00 E9 00 00 00 B4 74 DB F7 87 42 03 41 AF BA F1  ....tB.A
              00000240   B1 3D CD 75 CF 64 00 00 00 A0 00 00 00 30 F1 25  =ud...*...0%
              00000250   B7 EF 47 1A 10 A5 F1 02 60 8C 9E EB AC 04 00 00  G...`...
              00000260   00 78 00 00 00 30 F1 25 B7 EF 47 1A 10 A5 F1 02  .x...0%G...
              00000270   60 8C 9E EB AC 0C 00 00 00 50 00 00 00 E0 85 9F  `....P...
              00000280   F2 F9 4F 68 10 AB 91 08 00 2B 27 B3 D9 05 00 00  Oh...+'...
              00000290   00 46 01 00 00 2F 00 00 00 1E 00 00 00 00 47 00  .F.../........G.
              000002A0   72 00 6F 00 75 00 70 00 42 00 79 00 4B 00 65 00  r.o.u.p.B.y.K.e.
              000002B0   79 00 3A 00 50 00 49 00 44 00 00 00 13 00 00 00  y.:.P.I.D.......
              000002C0   00 00 00 00 1F 00 00 00 0E 00 00 00 00 46 00 46  .............F.F
              000002D0   00 6C 00 61 00 67 00 73 00 00 00 13 00 00 00 01  .l.a.g.s........
              000002E0   00 00 41 31 00 00 00 20 00 00 00 00 4C 00 6F 00  ..A1... ....L.o.
              000002F0   67 00 69 00 63 00 61 00 6C 00 56 00 69 00 65 00  g.i.c.a.l.V.i.e.
              00000300   77 00 4D 00 6F 00 64 00 65 00 00 00 13 00 00 00  w.M.o.d.e.......
              00000310   03 00 00 00 00 00 00 00 00 00 00 00              ............
    
    
    
    Paused. Press <Enter> to continue.:




    This brings up another point: I would like to have the same view settings on all accounts on my laptop. Can I just export
    Code:
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults
    in my regular account and then import it in my admin account?
    Yes, that should be fine. There's no account-specific information in a bag.





    Better yet, can I configure it via Group Policy?
    As I mentioned, I'm on Win!0 Home, I don't get to play with Group Policy. But I'm pretty sure you could.
    Last edited by KeithM; 19 Mar 2021 at 17:43.
      My Computer


  4. Posts : 59
    Windows 10 Pro x64 (Version 21H2, Build 19044.1415)
    Thread Starter
       #24

    KeithM said:
    [*]Any reason why you don't want to change it to RemoteSigned?.
    That *is* exactly what I wanted, but I can't
    Code:
    Set-ExecutionPolicy RemoteSigned
    in a non-privileged PowerShell ISE window.
    If I run PowerShell ISE "as administrator", then I am accessing the admin account's HKCU hive instead of my own.
    Anyway, I don't need PowerShell for this (yet). Once I set up the template types as you suggested, just deleting these registry keys seem to have produced the results I wanted for dialogs and folders on my local drives
    Code:
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32 
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CIDOpen 
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CIDSave 
    HKCR\Local Settings\Software\Microsoft\Windows\Shell\BagMRU
    HKCR\Local Settings\Software\Microsoft\Windows\Shell\Bags
    However, the template inheritance did not work across softlinks to network shares, all of which are considered "General items" unless I change them individually. Also, the Libraries retain the default views, even if I change "Optimize this library for" and then change it back to the desired type. Since the dialogs are OK. I consider this the end of this thread and will give @Brink credit for the solution of deleting the registry keys
    Code:
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32 
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CIDOpen 
    HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CIDSave
    I will start a new thread about folders and/or libraries if I find a way to fix the library views and/or set the desired views via group policy. Thanks for all your help. I have learned a lot from studying your scripts.
      My Computer


  5. Posts : 958
    Microsoft Windows 10 Home
       #25

    Most PowerShell users recommend steering clear of the ISE. It behaves differently form the PowerShell console. No wonder you're not getting results!

    Did you ever take a look at FT_Lookup (hashtable created by code) ? If you had, you would not be surprised that Libraries behave differently! It lists all the FolderTypes.
    Code:
    PS C:\> Function Get-CustomFolderTypes {
    >>     $Defaults = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults'
    >>     $FT       = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes'
    >>
    >>
    >>     If ( ! ( $global:FT_Lookup )) {      # Available for interactive use
    >>         $sbBegin   = {$hash = @{         # for duration of PowerShell session
    >>             '{25CC242B-9A7C-4F51-80E0-7A2928FEBE42}' = 'Network'
    >>             '{D6D9E004-CD87-442B-9D57-5E0AEB4F6F72}' = 'Recycle Bin'
    >>         }}
    >>         $global:FT_Lookup = gci $FT | ForEach $sbBegin {
    >>              $hash.Add( $_.PSChildName , ($_).GetValue('CanonicalName') )
    >>         } { $hash }
    >> @"
    >>         FT_Lookup: FolderTYpeID -> FolderType Name created.
    >>         Use:
    >>         `t"`$FT_Lookup.GetEnumerator() | sort value | ft -AutoSize"
    >>         to view in console or type:
    >>         `t"`$FT_Lookkup | Out-GridView"
    >>         to browse, sort, and filter.
    >> "@ | Write-Host
    >>     }
    >>
    >>
    >>     If ( Test-Path $Defaults ) {
    >>         (gi $Defaults).Property | ForEach{ [PSCustomObject]@{
    >>             'ID'  = $_
    >>             'Name'= $FT_Lookup[$_]
    >>         }}
    >>     } Else {
    >>          Write-Host "`n`t`tNo Customized Templates`n"
    >>     }
    >> }
    >> Set-Alias -Name gcft -Value Get-CustomFolderTypes
    >> gcft
            FT_Lookup: FolderTYpeID -> FolderType Name created.
            Use:
                    "$FT_Lookup.GetEnumerator() | sort value | ft -AutoSize"
            to view in console or type:
                    "$FT_Lookkup | Out-GridView"
            to browse, sort, and filter.
    
    ID                                     Name
    --                                     ----
    {B3690E58-E961-423B-B687-386EBFD83239} Pictures
    {885A186E-A440-4ADA-812B-DB871B942259} Downloads
    {94D6DDCC-4A68-4175-A374-BD584A510B78} Music
    {5C4F28B5-F869-4E84-8E60-F11DB97C5CC7} Generic
    {5FA96407-7E77-483C-AC93-691D05850DE8} Videos
    {7D49D726-3C21-4F05-99AA-FDC2C9474656} Documents
    {24CCB8A6-C45A-477D-B940-3382B9225668} HomeFolder
    {DD61BD66-70E8-48DD-9655-65C5E1AAC2D1} StorageProviderDocuments
    {672ECD7E-AF04-4399-875C-0290845B6247} StorageProviderMusic
    {71D642A9-F2B1-42CD-AD92-EB9300C7CC0A} StorageProviderPictures
    {51294DA1-D7B1-485B-9E9A-17CFFE33E187} StorageProviderVideos
    {4F01EBC5-2385-41F2-A28E-2C5C91FB56E0} StorageProviderGeneric
    {D6D9E004-CD87-442B-9D57-5E0AEB4F6F72} Recycle Bin
    {0B0BA2E3-405F-415E-A6EE-CAD625207853} Searches
    {DE2B70EC-9BF7-4A93-BD3D-243F7881D492} Contacts
    {DB2A5D8F-06E6-4007-ABA6-AF877D526EA6} AccountPictures
    {2C7BBEC6-C844-4A0A-91FA-CEF6F59CFDA1} Printers
    
    
    PS C:\> $FT_Lookup.GetEnumerator() | sort value | ft -AutoSize
    
    Name                                   Value
    ----                                   -----
    {db2a5d8f-06e6-4007-aba6-af877d526ea6} AccountPictures
    {91475fe5-586b-4eba-8d75-d17434b8cdf6} Communications
    {503a4e73-1734-441a-8eab-01b3f3861156} Communications.SearchResults
    {80213e82-bcfd-4c4f-8817-bb27601267a9} CompressedFolder
    {de2b70ec-9bf7-4a93-bd3d-243f7881d492} Contacts
    {524ddb2b-2a4f-43b8-b8fe-e91ef9d8ba69} Contacts.Library
    {654a1b99-8a4b-4e7b-a4e1-46378ad77a61} Contacts.LibraryFolder
    {20338b7b-531c-4aad-8011-f5b3db2123ec} Contacts.SearchResults
    {0c3794f3-b545-43aa-a329-c37430c58d2a} ControlPanelAllItems
    {de4f0660-fa10-4b8f-a494-068b20b22307} ControlPanelCategory
    {7d49d726-3c21-4f05-99aa-fdc2c9474656} Documents
    {fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9} Documents.Library
    {3f98a740-839c-4af7-8c36-5badfb33d5fd} Documents.LibraryFolder
    {36011842-dccc-40fe-aa3d-6177ea401788} Documents.SearchResults
    {885a186e-a440-4ada-812b-db871b942259} Downloads
    {B372207C-0011-438F-9151-098B2E36B887} FileItemAPIs
    {5c4f28b5-f869-4e84-8e60-f11db97c5cc7} Generic
    {5f4eab9a-6833-4f61-899d-31cf46979d49} Generic.Library
    {da3f6866-35fe-4229-821a-26553a67fc18} Generic.LibraryFolder
    {7fde1a1e-8b31-49a5-93b8-6be14cfa4943} Generic.SearchResults
    {24ccb8a6-c45a-477d-b940-3382b9225668} HomeFolder
    {549461d3-eb58-4c80-ba29-f1204c4502c3} Internet
    {94d6ddcc-4a68-4175-a374-bd584a510b78} Music
    {3f2a72a7-99fa-4ddb-a5a8-c604edf61d6b} Music.Library
    {978e0ed7-92d6-4cec-9b59-3135b9c49ccf} Music.LibraryFolder
    {71689ac1-cc88-45d0-8a22-2943c3e7dfb3} Music.SearchResults
    {25CC242B-9A7C-4F51-80E0-7A2928FEBE42} Network
    {8faf9629-1980-46ff-8023-9dceab9c3ee3} OpenSearch
    {B337FD00-9DD5-4635-A6D4-DA33FD102B7A} OtherUsers
    {3D1D4EA2-1D8C-418a-BFF8-F18370157B55} OtherUsers.SearchResults
    {b3690e58-e961-423b-b687-386ebfd83239} Pictures
    {0b2baaeb-0042-4dca-aa4d-3ee8648d03e5} Pictures.Library
    {c1f8339f-f312-4c97-b1c6-ecdf5910c5c0} Pictures.LibraryFolder
    {4dcafe13-e6a7-4c28-be02-ca8c2126280d} Pictures.SearchResults
    {2c7bbec6-c844-4a0a-91fa-cef6f59cfda1} Printers
    {d674391b-52d9-4e07-834e-67c98610f39d} Programs
    {7F2F5B96-FF74-41da-AFD8-1C78A5F3AEA2} PublishedItems
    {921C636D-9FC8-40d7-899E-0845DCD03010} PublishedItems.SearchResults
    {D6D9E004-CD87-442B-9D57-5E0AEB4F6F72} Recycle Bin
    {6ef8b050-8a6a-4d79-8344-9dfb5cf391fb} RestrictedNonIndexed
    {982725ee-6f47-479e-b447-812bfa7d2e8f} SearchConnector
    {0b0ba2e3-405f-415e-a6ee-cad625207853} Searches
    {834d8a44-0974-4ed6-866e-f203d80b3810} SearchHome
    {ef87b4cb-f2ce-4785-8658-4ca6c63e38c6} StartMenu
    {DD61BD66-70E8-48dd-9655-65C5E1AAC2D1} StorageProviderDocuments
    {4F01EBC5-2385-41f2-A28E-2C5C91FB56E0} StorageProviderGeneric
    {672ECD7E-AF04-4399-875C-0290845B6247} StorageProviderMusic
    {71D642A9-F2B1-42cd-AD92-EB9300C7CC0A} StorageProviderPictures
    {51294DA1-D7B1-485b-9E9A-17CFFE33E187} StorageProviderVideos
    {6D9969FF-612F-48EF-9B90-853FD82E6EC2} Sync
    {CD0FC69B-71E2-46e5-9690-5BCD9F57AAB3} UserFiles
    {e053a11a-dced-4515-8c4e-d51ba917517b} UserFiles.SearchResults
    {C4D98F09-6124-4fe0-9942-826416082DA9} UsersLibraries
    {59BD6DD1-5CEC-4d7e-9AD2-ECC64154418D} UsersLibraries.SearchResults
    {5fa96407-7e77-483c-ac93-691d05850de8} Videos
    {631958a6-ad0f-4035-a745-28ac066dc6ed} Videos.Library
    {292108be-88ab-4f33-9a26-7748e62e37ad} Videos.LibraryFolder
    {ea25fbd7-3bf7-409e-b97f-3352240903f4} Videos.SearchResults
    I've told you & showed you that Libraries are differeent.

    I still don't think the CIDOpen, CIDSave, & ComDlg32 affect this issue. I've been runniung ProcMon looking for qeries of those keys and no dice. Your file systm folders are behaving now because of Apply to Folders combined with cleafring BagMRU & Bags.

    If you have backups, restore BagMRU & Bags and delete Streams\Defaults entries and test the deletion of CIDOpen, CIDSave, & ComDlg32 by themselves. I've yet to see concrete evidence they affect anything.

    If you're going to close the thread, I won't bother with ifo on Libraries & SearchResults.
      My Computer


  6. Posts : 59
    Windows 10 Pro x64 (Version 21H2, Build 19044.1415)
    Thread Starter
       #26

    KeithM said:
    Most PowerShell users recommend steering clear of the ISE. It behaves differently form the PowerShell console. No wonder you're not getting results!
    Thanks for the tip; I am quite new to PowerShell, and read the opposite on another thread somewhere. As a former SW developer I can read PS script, but I don't know it (or the Windows functions and data structures) well enough to use it effectively.
    KeithM said:
    Did you ever take a look at FT_Lookup (hashtable created by code) ? If you had, you would not be surprised that Libraries behave differently! It lists all the FolderTypes.
    This would have been way beyond me, but the results you show here are a revelation and quite educational.
    KeithM said:
    I still don't think the CIDOpen, CIDSave, & ComDlg32 affect this issue. I've been runniung ProcMon looking for qeries of those keys and no dice. Your file systm folders are behaving now because of Apply to Folders combined with cleafring BagMRU & Bags.

    If you have backups, restore BagMRU & Bags and delete Streams\Defaults entries and test the deletion of CIDOpen, CIDSave, & ComDlg32 by themselves. I've yet to see concrete evidence they affect anything.
    I haven't done extensive testing, but I tried restoring my backup of those keys and don't see any difference, as you predicted. However, if they don't serve any purpose, why keep them? As a corollary to this and as @Farvatten observed early on in this thread, the view displayed in the open/save dialog appears to depend on the view assigned to the folder being opened.
    KeithM said:
    If you're going to close the thread, I won't bother with ifo on Libraries & SearchResults.
    No disrespect intended, but I feared that we were straying from the original topic of the thread. However, based on your observations, it appears that open/save dialog views are inextricably linked to the views defined for other purposes.
    I would be delighted to learn more about configuring the views for Libraries and Search Results.
    What is really annoying is how inconsistently Windows displays the same folder, depending on how it is reached. For example, if I open my user folder under C:\Users, it conforms to the view I defined for "General items", but if I open it under "This PC"(after deleting Bags and BagMRU) it is displayed with "Medium icons". If I display a network shared documents folder via a symlink in a local documents folder, it displays the view of the Document type template. If I display the same directory via UNC, it displays a kind of generic view that I haven't (knowingly) defined anywhere. If I navigate to this directory in an open dialog, the symlink is immediately dereferenced to the UNC path, making it impossible to have the desired view in an open dialog
      My Computer


  7. Posts : 958
    Microsoft Windows 10 Home
       #27

    rsbrux said:
    Thanks for the tip; I am quite new to PowerShell, and read the opposite on another thread somewhere. As a former SW developer I can read PS script, but I don't know it (or the Windows functions and data structures) well enough to use it effectively.
    I hope you'll get your execution policy figured out and start playing. It's truly addictive.


    This would have been way beyond me, but the results you show here are a revelation and quite educational.
    Don't put yourself down --- I'm sure you can copy & paste & type in a console.


    I haven't done extensive testing, but I tried restoring my backup of those keys and don't see any difference,
    as you predicted. However, if they don't serve any purpose, why keep them? As a corollary to this and as @Farvatten observed early on in this thread, the view displayed in the open/save dialog appears to depend on the view assigned to the folder being opened.
    I've been saying the same thing (If the dialog doesn't have a view saved for a particular path, it used the defalut view of the corresponding FolderType). To clarify, those keys have no effect on Icon Mode. ComDlg32 remembers window metrics ( size, position, expand/collapse) and MostRecentlyUsed (MRU) paths based on file extension.


    No disrespect intended, but I feared that we were straying from the original topic of the thread. However, based on your observations, it appears that open/save dialog views are inextricably linked to the views defined for other purposes.
    Most aren't receptive to code thrown at them with no explanation.

    I have a hard time telling people how without telling them why something works as well.


    I would be delighted to learn more about configuring the views for Libraries and Search Results.
    Cool. I've got SearchResults licked and also figured out forcing dialogs to Details even if you've set the default for Explorer to another mode. I want to play more with Libraries.


    What is really annoying is how inconsistently Windows displays the same folder, depending on how it is reached. For example, if I open my user folder under C:\Users, it conforms to the view I defined for "General items", but if I open it under "This PC"(after deleting Bags and BagMRU) it is displayed with "Medium icons". If I display a network shared documents folder via a symlink in a local documents folder, it displays the view of the Document type template. If I display the same directory via UNC, it displays a kind of generic view that I haven't (knowingly) defined anywhere. If I navigate to this directory in an open dialog, the symlink is immediately dereferenced to the UNC path, making it impossible to have the desired view in an open dialog
    "That's not a bug, it's a feature!"


    Did you take note that the folder rooted in the Desktop that labeled with your full user name, the folder that opens with:

    • shell:UsersFilesFolder

    has a FolderType all its own that needs to be set with Apply to Folders?

    • UserFiles: {CD0FC69B-71E2-46e5-9690-5BCD9F57AAB3}

    First, I think you'll find more consistency with a full compliment of values under Streams\Defaults. What you're describing is due to the fact that saved views (Bags) are indexed by their Shell SNamespace path, with everything rooted in the Virtual Desktop. It's the tree structure you see in the Navigation Pane when Show all folders is enabled or the classic Browse for Folder dialog:

    How to  enforce &quot;Details&quot; view in Windows File Select Dialog?-browse-folder.png
    Rather than battle that, I think it's easier to be aware of why you're seeing what your seeing and perhaps use it to your advantage. For instance, I discovered while testing for this thread that I could force the Generic view on all fiole system folders, but Libraries retained their contnt-specific anture.

    As for network folders, first & foremost, my testing is extremely limited in that regard because my "network" consists if a router with an external hard drive attached via USB. But network folders that have been viewed "cross over" from:

    • HKCU\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags

    to
    • HKCU\SOFTWARE\Microsoft\Windows\Shell\Bags

    where the view information is stored. They match up not by bag number but by the Namespace path extracted from BagMRU. Note that the Bags key under HKCU\SOFTWARE\Microsoft\Windows\Shell will always have Bag #1 with a subkey named Desktop. This key holds the view settings for Desktop seen when all windows are minimized. It's the only bag that has the value named IconLayouts, which controls icon order & position on the Desktop. But the other keys may be holding saved views & at the moment, I'm not sure if those are cleared by Apply to Folder, so deleting those might force them to at least use your custom Generic template. Will test more later.
    Last edited by KeithM; 21 Mar 2021 at 13:30.
      My Computer


  8. Posts : 958
    Microsoft Windows 10 Home
       #28

    And now,
    drum-roll please,
    the moment you've all been waitng for:
    A brand new ( most likely old but undocumented ) way to control CommonDialog icon mode
    ( and any other view setting saved in a bag )
    and do the same for
    SearchResults ( "Die, Content view, die!" )

    The patience I begged for has paid off. I have found the magic bullet.


    • Dialogs opening in Detail mode regardless of the default icon mode of the corresponding FolderType or the icon mode of the view saved under Bags.


    When opening a common dialog from Notepad ( my go-to app for testing ComDlg settings ), ProcMon revealed queries to both:

    • HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\ComDlg\<FolderTypeID>


    and
    • HKLM\Software\Microsoft\Windows\Shell\Bags\AllFolders\ComDlg\<FolderTypeID>



    with <FolderTypeID> dependent on the FolderType of the folder displayed. without those keys existing, the dialogs will fall back to the default view for the FolderType. But, once you create them, they will be queried for the "standard" values found in a bag. And the nice thing is, you don't have to provide a complete set of values, only those you want to override.

    AllFolders only exists under HKCU by default, where its effects are per-user. but it can exist under HKLM as well, where it can define machine-wide defaults. As the OP expressed a preference for machine-wide settings, (as well as shorteer pathnames), the following edits modify HKLM, but can be easlly modified create the entries under HKCU.

    So I used this (requires an Admin PowerShell console) :
    Code:
    $HKLM_AllFolders      = 'HKLM:\SOFTWARE\Microsoft\Windows\Shell\bags\AllFolders'
    $HKLM_AF_ComDlg       = "$HKLM_AllFolders\ComDlg"
    $HKLM_AF_ComDlgLegacy = "$HKLM_AllFolders\ComDlgLegacy"
    $HKLM_AF_Shell        = "$HKLM_AllFolders\Shell"
    $FolderTypes          = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes'
    $Bags                 = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
    $FTID_Downloads       = '{885a186e-a440-4ada-812b-db871b942259}'
    $FTID_Network         = @{ 'ID'='{25CC242B-9A7C-4F51-80E0-7A2928FEBE42}' ; 'CanonicalName'='Network' }
    $FTID_RecycleBin      = @{ 'ID'='{D6D9E004-CD87-442B-9D57-5E0AEB4F6F72}' ; 'CanonicalName'='Recycle Bin' }
    
    ### --- Set Common Dialogs to Deails for all FolderTypes --- ###
    
    $HKLM_AF_ComDlg , $HKLM_AF_ComDlgLegacy , $HKLM_AF_Shell | ForEach{
        If ( -not ( Test-Path $_ )) { New-Item $_ -Force | Out-Null }
    }
    ### IDs defined in registry
    
    Get-ChildItem $FolderTypes | Get-ItemProperty | ForEach{
      New-Item -Path $HKLM_AF_ComDlg -name $_.PSChildName -Value $_.CanonicalName -Force |
        New-ItemProperty -Name Mode -Value 4 | Out-Null
    
      New-Item -Path $HKLM_AF_ComDlgLegacy -name $_.PSChildName -Value $_.CanonicalName -Force |
        New-ItemProperty -Name Mode -Value 4 | Out-Null
    }
    ### Hard-coded IDs
    
    $FTID_Network , $FTID_RecycleBin | ForEach{
      New-Item -Path $HKLM_AF_ComDlg -Name $_.ID -Value $_.CanonicalName -Force |
        New-ItemProperty -Name Mode -Value 4 | Out-Null
    
      New-Item -Path $HKLM_AF_ComDlgLegacy -Name $_.ID -Value $_.CanonicalName -Force|
        New-ItemProperty -Name Mode -Value 4 | Out-Null
    }
    ### Turn off grouping in Downloads
    
    $HKLM_AF_ComDlg , $HKLM_AF_ComDlgLegacy | ForEach{
        New-ItemProperty -Path "$_\$FTID_Downloads" -Name GroupView -Value 0 | Out-Null
    }
    to create a subkey for every defined FolderType as well as the hard-coded values for Network and Recycle Bin. I'm sure some are never accessed but creating the full set is easiest and unused values don't screw up anything.

    After running the code, the regisry entries look like this:

    How to  enforce &quot;Details&quot; view in Windows File Select Dialog?-screenshot-945-.png

    For the sake of backwards compatibilty with batch enthusiasts, here's the .reg export.



    In a simiar manner, with the variables defined in the above block, SearchResults FolderTypes can be forced to Details with this code:

    Code:
    Get-ChildItem $FolderTypes | Get-ItemProperty | Where CanonicalName -match SearchResults | ForEach{
        New-Item -Path $HKLM_AF_Shell -Name $_.PSChildName -Value $_.CanonicalName -Force |
          New-ItemProperty -Name Mode -Value 4 | Out-Null
    }








    You read it here first, folks!
    Last edited by KeithM; 25 Jul 2021 at 22:33. Reason: Forgot variable assignments!!
      My Computer


  9. Posts : 59
    Windows 10 Pro x64 (Version 21H2, Build 19044.1415)
    Thread Starter
       #29

    Sorry to be so slow responding: I have been occupied with more pressing matters.
    The first PS script in your post above (inline) gave me innumerable errors similar to:
    Code:
    New-Item : Cannot bind argument to parameter 'Path' because it is null.
    At line:5 char:18
    +   New-Item -Path $HKLM_AF_ComDlgLegacy -name $_.PSChildName -Value $_ ...
    +                  ~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidData: (:) [New-Item], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.NewItemComm
       and
    I didn't see any effect on the "Save as" dialog in a Picture type folder. Would a restart be needed?

    P.S. the script Create_HKLM_AllFolders_Common_Dialogs_SearchResults ran without errors (but also without showing any output in the PS window I opened to execute it). I don't see any changes yet, but will try logging out and logging into another account to check results.

    P.P.S. The script file seems to have had the desired results. By now I would have thanked you many times, if the forum would allow it, but it seems to allow only one "Thanks" per person per thread ;-{
    Last edited by rsbrux; 29 Apr 2021 at 07:31.
      My Computer


  10. Posts : 958
    Microsoft Windows 10 Home
       #30

    DId the downloaded file give you the errors? If so which one?

    If you tried to run the snippet in my reply without the variables defined, that error makes sense....
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 19:27.
Find Us




Windows 10 Forums