Adds PercievedType = txt To Windows Registry for Extension passed as argument (with dot at front, e.g. .txt). This is useful for viewing linux dotfiles, e.g. .htaccess .git-config, in the preview pane.
@ECHO OFF
@SETLOCAL enabledelayedexpansion
@SET "ext=%1"
@SET "assoc_type=%2"
IF /I NOT DEFINED assoc_type (
@SET "extname=!ext:.=!"
@SET "assoc_type=!extname!-file"
)
REG ADD HKCR\!ext! /T REG_SZ /D !assoc_type! /F
IF ERRORLEVEL 0 (
REG ADD HKCR\!ext! /T REG_SZ /v PerceivedType /D text /F
) ELSE (
GOTO ERR
)
@EXIT /B
:ERR
@ECHO Error Adding FileType