[Tutor] Cmd Advice
Dave Angel
d at davea.name
Sat Feb 11 14:04:49 CET 2012
On 02/11/2012 07:53 AM, Dave Hanson wrote:
> <SNIP>
> I did try with pause during my previous attempts to get the .bat file
> running and when it ran with no errors I tried the pause again, pressed
> Enter and the window just closes and nothing happens.
>
> Cmd.exe does still exist, it's just that when you run it the message is
> displayed saying I can't use it, I have a degree in computer forensics and
> so know the registry key to remove the restricted access, this only lasts
> until a reboot occurs then I have to do it again - and if I'm honest it's
> not very professional of me to be 'buggering about' with my work machine's
> registry.
>
> If I understand your proposed 'loop' method correctly, could I use that to
> pass commands to my "t" program then do you think? or have the loop built
> into the "t.py" script?
>
PAUSE in a batch file is run by CMD.EXE. So there is such a program,
and it is, at least to some degree, available.
How about a 3 line batch file
:labletop
cmd
pause
goto labeltop
If that cmd works, you'll have an unrestricted cmd window. if it
doesn't , you should write your own, more restricted, shell. And
replace cmd above with python myshell
(with appropriate cd's and suchlike)
The shell doesn't have to be too complex, just a raw_input() followed by
perhaps a split and some subprocess command.
But one of the advantages of having a standard shell running when you
start python is that if it crashes, you don't lose the window. The
pause would do that for you.
--
DaveA
More information about the Tutor
mailing list