🔖

エクスプローラーの「開いているフォルダーまで展開」の設定を行う (バッチファイル)

2021/07/06に公開
@echo off
chcp 65001 > nul
setlocal ENABLEDELAYEDEXPANSION

if "%1"=="Disable" (
    rem Disable NavPaneExpandToCurrentFolder
    set REGKEY_KEYNAME_EXPLORER_ADVANCED=HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
    reg.exe add "!REGKEY_KEYNAME_EXPLORER_ADVANCED!" /v "NavPaneExpandToCurrentFolder" /t REG_DWORD /d "0" /f > nul
) else (
    rem Enable NavPaneExpandToCurrentFolder
    set REGKEY_KEYNAME_EXPLORER_ADVANCED=HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
    reg.exe add "!REGKEY_KEYNAME_EXPLORER_ADVANCED!" /v "NavPaneExpandToCurrentFolder" /t REG_DWORD /d "1" /f > nul
)

endlocal
exit /b 0

Discussion