將 Windows 資源管理器列寬設定為小於 100 像素

將 Windows 資源管理器列寬設定為小於 100 像素

我想進一步減小「檔案副檔名」列的寬度:

在此輸入影像描述

我可以右鍵單擊 > 更多 > 突出顯示“檔案副檔名” > 但如果我想將“100”更改為更少的值,Windows 資源管理器不允許這樣做:

在此輸入影像描述

答案1

我還沒有升級到Win11,但是如果資料夾仍然將其視圖保存在註冊表項下: HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags

然後是下面的電源外殼會將列的寬度縮小到顯示該列的所有已儲存視圖中的File Extension預設寬度 ( ) 。$NewWidthFile Extension

然後,您可以選擇將其中任何一個設定為其關聯的自訂模板FolderType透過使用Apply to Folders

$NewWidth           = 0x35
$Bags               = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
$ExtPropKey         = [PSCustomObject]@{
                          'FmtID' = [GUID]'e4f10a3c-49e6-405d-8288-a23bd4eeaa6c'
                          'PID'   = 100
                      }
$PropKeyAsBytes     = $ExtPropKey.FmtID.ToByteArray() + [BitConverter]::GetBytes($ExtPropKey.PID)
$Encoder            = [System.Text.Encoding]::GetEncoding(28591)
$RegEx              = [Regex]$Encoder.GetString( $PropKeyAsBytes )

gci $Bags -Recurse |
    ? PSChildName -like '{*}' |
    ? Property -contains  'ColInfo' |
ForEach-Object{
    $ColInfoAsText   = $Encoder.GetString(( $ColInfoAsBytes = $_.GetValue('ColInfo') ))

    If ( ( $ColumnPresent = $RegEx.Match( $ColInfoAsText ) ).Success )
    {        
        $WidthOffset                  = $ColumnPresent.Index + 0x14
        $ColInfoAsBytes[$WidthOffset] = $NewWidth
        $Splat = @{
            'Path'    = $_.PSPath
            'Name'    = 'ColInfo'
            'Value'   = $ColInfoAsBytes
        }
        Set-ItemProperty @Splat
    }
}

相關內容