Skip to content

Instantly share code, notes, and snippets.

@olliencc
Created June 29, 2020 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olliencc/bd3995c510d5ed240ccd57883f607fe4 to your computer and use it in GitHub Desktop.
Save olliencc/bd3995c510d5ed240ccd57883f607fe4 to your computer and use it in GitHub Desktop.
Show which program will load which extension when you double click in CSV format
@echo off
REM °²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²°
REM °² Enumerates all files extensions ²°
REM °² and what opens them on Windows 10 in batch/cmd ²°
REM °² twitter: @ollieatnccgroup ²°
REM °²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²°
for /f "tokens=1,2 delims==" %%G in ('assoc') do (
for /f "tokens=1,2 delims==" %%I in ('ftype %%H 2^> nul') do (
echo %COMPUTERNAME%,%%G,%%J
)
)
@PolarBearGod
Copy link

Slight issue with this batch script. ftype command is only aware of the following registry key:
HKCR\htmlfile\shell\open\command\(Default)
Which means that the user's browser choice or other custom choices are not reported correctly.

It does not see:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice
Which can have a different application that the user might have selected.

Source: https://stackoverflow.com/questions/51715292/best-way-to-get-file-type-association-in-windows-10-from-command-line

@olliencc
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment