Ionic liquids containing the nitrile and vinyl functional groups attached to imidazolium cations combined with various anions, e.g., iodide, bis[(trifluoromethyl)sulfonyl]imide ([TFSI]-), or dicyanamide ([N(CN)2]-), have been prepared and characterized. These ionic liquids have been successfully used as electrolytes for dye-sensitized solar cells based on nanocrystalline TiO2 with the amphiphilic ruthenium sensitizer [ruthenium (4,4'-dicarboxylic acid-2,2'-bipyridine)(4,4'-bis(p-hexyloxystyryl)-2,2'-bipyridine)][NCS]2 (coded K-19). The iodide salt was used in 3-methoxypropionitrile-based electrolytes, and the performances of both types of devices were evaluated on the basis of their photocurrent density-voltage characteristics and dark current measurements, demonstrating that the functional groups do not exert a detrimental effect on the performance. The solid-state structure of the nitrile-functionalized salt [C1C3CN(im)]I has also been established by single-crystal X-ray diffraction, revealing extensive hydrogen bonding between the cation protons and the iodide.