🦁

エクスプローラーの「登録されている拡張子を表示」の設定を行う (バッチファイル)

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

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

rem Require to restart Explorer

endlocal
exit /b 0

Discussion