Inspect file associations with assoc and ftype

Two forgotten CMD built-ins that map extension → file type → executable command.

WindowsconfigurationcmddeveloperMedium risk
Run assoc .ext to see a file type name, then ftype <TypeName> to see the command that launches it; assign with ftype Name="cmd" %1 %*.

01Command

Command
$ assoc .py ; ftype Python.File

02What it does

The chain is two-stage: assoc maps an extension (e.g. .py) to a type name, and ftype maps that type to the actual command line where %1 is the file and %* the extra arguments. Setting both is how scripts register custom handlers, e.g. assoc .log=MyLog and ftype MyLog=notepad.exe %1. These live in the registry under HKCR, so ftype is effectively a registry shortcut.

03Risk

RiskMedium risk
RequirementsAdministrator rights to change system-wide associations
!Warning: Modern Windows often overrides these with per-user and UI-based associations — a Settings app choice beats what assoc/ftype set, so verify behavior after changing.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • ASSOC - Windows CMD
    SS64 · technical · 2026-09-17
    Evidence: SS64 explains assoc mapping extensions to file types and ftype mapping file types to commands, with examples of setting both.
  • ftype | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    Evidence: Microsoft documents ftype displaying or modifying file type command strings used by assoc, including %1 %* argument substitution.

Last verified: 2026-09-17 · Category: Developer

06Related solutions