With home theater PCs and Android set-top boxes becoming ever more popular (not least because companies such as Valve seem to want to make you game in the living room), lots of people want to set up a device that can run emulators and their ROMs at decent speeds. Nowadays you have many, many alternatives for that, and one of them is the good old Windows PC, which can be the most powerful overall.
In their search, these people stumble upon RetroArch, a very nifty and powerful emulation program and IMO the best you could use. It's cross-platform and supports a lot of shaders that can make your retro games look pretty close to what they used to look like when displayed on old CRT TVs. However, RetroArch can be rather difficult to setup and many people have problems doing it.
This is a guide to RetroArch's command line so you can easily set it up to automatically load cores and run ROMs. It's focused on Windows but, with the needed changes to folder paths and extensions, it should work for Linux, Android and Mac as well.
First of all, RetroArch by itself is NOT an emulator, it's an application that can load a variety of cores to emulate different systems. These cores are the emulation part of RetroArch and what contains the emulation code. The emulator's source code is ported to the libretro API and later compiled for use in different systems. The RetroArch program could barely be called a front end, though it does include a user interface (RGUI) which you can use to sort all your configuration.
This guide assumes that you have already configured all your folders inside RetroArch. Now, for the command line part.
List of all RetroArch parameters: https://github.com/libretro/RetroArch/wiki/Using-the-command-line
The main ones you'll use with every front end are:
-f or --fullscreen: Launches game in fullscreen.
-L or --libretro: Loads core. Example: nestopia_libretro.dll for NES.
-c or --config: Loads configuration file. Recommended to be a general config file (example: RetroArch.cfg)
--appendconfig: The real magic of RetroArch is allowing you to append special configs to a main one. You could use one for each console or each core, for example. These go after the main config and you can add as many as you want provided you separate them with a "," (comma) between them.
The path of each file is either absolute or relative, so if cores for example are stored in a subfolder of the folder that contains the RetroArch executable, say, "C:\RetroArch\cores", the path can be either "C:\RetroArch\cores" or just "cores", but if the cores are elsewhere the path must be absolute. Quotes aren't needed but are useful if you use folders with names that have spaces.
So... If you have the following setup:
1) RetroArch.exe installed in C:\RetroArch
2) Cores in C:\RetroArch\cores
3) You want to load the Nestopia core (nestopia_libretro.dll)
4) Main config file called RetroArch.cfg in C:\RetroArch
5) Secondary config called nes.cfg in C:\RetroArch\config
The command line to automatically load NES ROMs via RetroArch will be:
RetroArch.exe -f -L cores\nestopia_libretro.dll -c RetroArch.cfg --appendconfig config\nes.cfg (path to NES ROM)
Typing all this in the Command Prompt will make RetroArch run in a fullscreen, load the Nestopia core, apply both configs (RetroArch.cfg before NES.cfg) and load the ROM you want.
However, different front ends have different requirements. Since most of them scrape ROMs for metadata, they usually require wildcards such as %ROM% (Advanced Launcher for Kodi, Rom Collection Browser for Kodi, EmulationStation), or %r (Ice for Steam). This will allow the front end to scrape the ROM and build the shortcut according to what it scraped.
That's basically it for the RetroArch command line. You can experiment with it and do many great things. The -s or --save parameter is particularly useful because it allows you to load different saves, otherwise it defaults to the save named after the ROM. You can use it to run different saves of Pokémon, for example, which have only one file per save. The patch parameters, --ips for example, can be used to automatically patch ROMs for that session only, without permanently modifying the ROM.
As of version 1.3, RetroArch has a variety of pretty GUIs to choose from besides the old RGUI, so you don't need to have a dedicated front end anymore. This, however, will require you to create shortcuts to automatically load the cores and run each game.
EDIT: Member "Borg-101" at Kodi forums pointed out a mistake in my config, you should not use backward slashes ( \ ) at the beginning of each path. Thanks a lot, buddy. :)