Distances are shown in the European Rail Timetable (and in national timetables which you can hunt down and download).
The Schweers and Wall atlases also give detailed kilometrage (Germany, Austria, Switzerland, Italy, Slovenia, Northern France).
Many lines in/around Germany have these details on Wikipedia entries (sometimes only in the German version).
eg here is the page for the Thuringia Railway (Halle-Bebra):
https://en.wikipedia.org/wiki/Halle–Bebra_railway
You can click on the links for connecting lines, all over Germany if need be.
Here's another for Paris-Strasbourg:
https://fr.wikipedia.org/wiki/Ligne_de_Paris-Est_à_Strasbourg-Ville
The French version is much more detailed than the English, even giving you the speed profile for the route.
If you click on "Schema de la Ligne" you get the distance details for the whole line.
So the answer rather depends where you went.