In C1, use at the for natural wording; ie, “Run this command at the Windows prompt”. Some people may speak of “in the Windows prompt”, by which they probably mean in a DOS window (so they should be saying “Run this command in a DOS window”, which is acceptable), but at the is more exact and more natural when referring to entering a command at a command prompt.
In C2, using or via are better: “Execute the command using menu option ‘File->Preferences’” or “Execute the command via menu option ‘File->Preferences’”. Although by and through are possibilities in C2, neither is as good as either of using or via. (Disclaimer: If I understand correctly, I'd say “Select menu option ‘File->Preferences’” instead of “Execute the command via menu option ‘File->Preferences’”, because I doubt you can actually execute commands via the File
menu.)