Is there any way to check if the script is being run in the Windows command line?

Honestly I do not know the answer. I think it is more difficult than it seems.
Why do you need that? Maybe there is another way to solve the problem.

You could find out the os by importing the platform module
platform.system() should give the os or if your looking for a particlar release you could use the platform.release()

import platform

if platform.system() == 'Windows':
   #Do something
else:
   #Do something else
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.