[Tutor] Cmd Advice
bodsda at googlemail.com
Sun Feb 5 17:07:38 CET 2012
On Feb 5, 2012 3:31 PM, "Dave Hanson" <dave at hansonforensics.co.uk> wrote:
> Thanks Alan.
> I have ran python programs before at work. But not ones you need to
continually interact with from the command line. This particular program
> Dos isn't unavailable, just windows + r and cmd are disabled by IT.
> I can force a dos window to open by using a bat or python program. What
I'm trying to get around is not being able to interact with the program
using [options] like -l for list for example.
> Also, Apologies if this is a top post, my phone is difficult to write on.
> Thanks again,
> On Feb 5, 2012 3:04 PM, "Alan Gauld" <alan.gauld at btinternet.com> wrote:
>> 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
>> 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.
>> Alan G
>> Author of the Learn to Program web site
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
Here are some other ways of launching cmd
The following techniques are used at your own risk
Task manager-> file-> New process-> cmd
Rename cmd.exe to cmd2.exe and run it
Try running command.com then cmd.exe
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor