In some video games, and art you will sometimes see a high ranking officer using only a pistol even when much more powerful weapons are available.
For one thing, it should go without saying that video games are not an accurate depiction of reality per se. Furthermore, just what is being referred to be 'high ranking officers'? If they were general officers, one would expect them to remain in their command post, where they can control their unit the best, save for trips to wherever the front line may be, and thus would likely on need a pistol for self-defence.
In the Second Anglo-Boer War, and again in WWI (and most likely WWII), lower ranking officers like captains and lieutenants, officers that are certainly going to be 'in the thick of it', carried rifles, and pistols typically were concealed if they were carried at all. This was due to the rifle being a more effective weapon on the battlefield, but also so as to make them less distinguishable to the foe, and so be less likely to be killed.