[Tutor] Cmd Advice
alan.gauld at btinternet.com
Sun Feb 5 16:04:14 CET 2012
On 05/02/12 13:26, Dave Hanson wrote:
> So far so good. I then realised that at work (XP) I have restricted
> access to a command line and so wouldn't be able to use it, restricted
> in the sense of I simply am not permitted to access it!
Are you prevented from using it or is it just a company policy?
In other words can you type Windows-r and get the run dialog
and type cmd into it to bring up a dos box? But if you do so
you could be disciplined? Or is there something on your PC build that
actually stops cmd from working (which would be really strange since it
would stop a lot of windows tools from working!)
> revealed a class called "cmd" which I read up on
> http://docs.python.org/library/cmd.html and I also found a good
> site explaining the basics of how to use it
> I'm thinking of making it an executable file that pops up with a
> terminal that I can enter the commands as I would on my bash shell - if
> that makes sense?
But that will still need to run in a cmd window, whether launched
directly by you or indirectly by XP.
What happens if you create a desktop shortcut to one of your python
programs, say one like this:
print ("hello world")
input("Hit return to quit")
Does it bring up a console?
If so you have no problem, just use ypur normal script and create a
> * Am I going down the right route by using "Cmd" or is there a better way.
cmd is a useful module but largely irrelevant to your question. It is a
style of UI within a Python script. You may well decide to use cmd in
your script rather than presenting menus etc. But it has no influence on
whether your script will run on XP.
Author of the Learn to Program web site
More information about the Tutor