Foobar2000:Properties/Automatically Fill Values
From Hydrogenaudio Knowledgebase
To activate this dialog, choose "Automatically Fill Values" from the Tools menu of the Properties dialog.
The "Automatically Fill Values" dialog lets you transfer information about your tracks from file names, existing metadata fields or any other sources (through clipboard) to metadata fields. Its main purpose is to deal with files having empty or incorrect tags but correct artist/title/etc information in file names.
For an example, if you want to transfer metadata values from file names and your file naming scheme is "artist\album [date]\nn. title", you should set source to "File Names" and pattern to "%artist%\%album% [%date%]\%tracknumber%. %title%".
 Usage Tips
Note that the syntax used by Automatically Fill Values patterns is not based on title formatting and does not support any of title formatting specific features such as $functions() or square brackets for optional parts.
Different "source" modes in the Automatically Fill Values dialog have additional implications. For an example, source set to "Other..." / %filename% works differently than the "File Names" mode - the latter looks at names of folders containing your tracks if the pattern contains backslash characters.
If you want to ignore a part of the source pattern, you can insert a %% to prevent that section from being mapped to a field.