Inspect file associations with assoc and ftype
Two forgotten CMD built-ins that map extension → file type → executable command.
01Command
$ assoc .py ; ftype Python.File02What 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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- ASSOC - Windows CMDEvidence: SS64 explains assoc mapping extensions to file types and ftype mapping file types to commands, with examples of setting both.
- ftype | Microsoft LearnEvidence: 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
Use Windows Package Manager to install, search, and upgrade thousands of applications from the community repository in one command.
Understand PowerShell's execution policy scopes and set the one that lets you run your own local scripts without gutting the security model.
One command that shows OS version, install date, boot time, memory, network adapters and installed hotfixes.