Herrick, Kristina | 16 Jul 23:34 2008

Problem launching windows command shell from a Pywinauto test

I’m trying to start and use the windows command shell in a Pywinauto test. I was thinking that I could just use Pywinauto to manipulate the cmd.exe process the same way I do it with Notepad. But it doesn’t seem to be doing anything at all. I searched online and didn’t see anything about why a cmd shell application would be any different than any other kind of application.

 

So, what works with Notepad is:

 

self.app.start_(r"c:\windows\system32\notepad.exe")

 

Here’s what I tried with cmd:

 

self.app.start_(r"c:\windows\system32\cmd.exe")

 

With Notepad, the Notepad app just starts right up. When I try it with cmd, no apps start at all. No errors, just no command window. I tried it from a test method inside Wing running in debug mode (the way I normally run my tests during the development phase). I also tried it from a python shell window inside Wing. Here’s the Python shell contents:

 

Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]

Type "help", "copyright", "credits" or "license" for more information.

>>> from pywinauto import application

>>> app = application.Application()

>>> app.start_(r"c:\windows\system32\notepad.exe")

<pywinauto.application.Application object at 0x00BCD310>

>>> app.start_(r"c:\windows\system32\cmd.exe")

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

 

C:\local_pwa\HEAD\trigbuildertest><pywinauto.application.Application object at 0x00BCD310>

>>>

 

 

Note that Notepad started, but I didn’t see any cmd shells start. Though it does look like it tried to start a cmd shell. So something’s going on there. I don’t know what it could be.

 

Any thoughts or help would be appreciated. Maybe there is another way that people use out there that I’m not thinking of?

 

Thanks,

Kristina

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pywinauto-users mailing list
Pywinauto-users@...
https://lists.sourceforge.net/lists/listinfo/pywinauto-users
Garland, Ken R | 16 Jul 23:48 2008
Picon

Re: Problem launching windows command shell from a Pywinauto test

You are, at that point, in your new shell. It is the behavior of cmd.exe by design:

CMD will start a new instance of CMD.exe which will appear in the same window. The EXIT command will close the second CMD instance and return to the previous shell.

example from a python shell:

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pywinauto.application import Application
>>>
>>> app = Application()
>>> app.start_(ur"cmd.exe")
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Python25>echo
ECHO is on.

C:\Python25>echo "hello"
"hello"

C:\Python25>exit
<pywinauto.application.Application object at 0x01D64CF0>
>>>
>>>

On Wed, Jul 16, 2008 at 5:34 PM, Herrick, Kristina <kherrick-zC7DfRvBq/JWk0Htik3J/w@public.gmane.org> wrote:

I'm trying to start and use the windows command shell in a Pywinauto test. I was thinking that I could just use Pywinauto to manipulate the cmd.exe process the same way I do it with Notepad. But it doesn't seem to be doing anything at all. I searched online and didn't see anything about why a cmd shell application would be any different than any other kind of application.

 

So, what works with Notepad is:

 

self.app.start_(r"c:\windows\system32\notepad.exe")

 

Here's what I tried with cmd:

 

self.app.start_(r"c:\windows\system32\cmd.exe")

 

With Notepad, the Notepad app just starts right up. When I try it with cmd, no apps start at all. No errors, just no command window. I tried it from a test method inside Wing running in debug mode (the way I normally run my tests during the development phase). I also tried it from a python shell window inside Wing. Here's the Python shell contents:

 

Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]

Type "help", "copyright", "credits" or "license" for more information.

>>> from pywinauto import application

>>> app = application.Application()

>>> app.start_(r"c:\windows\system32\notepad.exe")

<pywinauto.application.Application object at 0x00BCD310>

>>> app.start_(r"c:\windows\system32\cmd.exe")

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

 

C:\local_pwa\HEAD\trigbuildertest><pywinauto.application.Application object at 0x00BCD310>

>>> 

 

Note that Notepad started, but I didn't see any cmd shells start. Though it does look like it tried to start a cmd shell. So something's going on there. I don't know what it could be.

 

Any thoughts or help would be appreciated. Maybe there is another way that people use out there that I'm not thinking of?

 

Thanks,

Kristina

 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pywinauto-users mailing list
Pywinauto-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/pywinauto-users


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pywinauto-users mailing list
Pywinauto-users@...
https://lists.sourceforge.net/lists/listinfo/pywinauto-users
Garland, Ken R | 16 Jul 23:51 2008
Picon

Re: Problem launching windows command shell from a Pywinauto test

Oh, I just had the thought that you may want the "window" as it were:

app.start_(ur"explorer cmd.exe")

Since it is basically an explorer extension.

On Wed, Jul 16, 2008 at 5:48 PM, Garland, Ken R <garlandkr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
You are, at that point, in your new shell. It is the behavior of cmd.exe by design:

CMD will start a new instance of CMD.exe which will appear in the same window. The EXIT command will close the second CMD instance and return to the previous shell.

example from a python shell:

Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on
win32

Type "help", "copyright", "credits" or "license" for more information.
>>> from pywinauto.application import Application
>>>
>>> app = Application()
>>> app.start_(ur"cmd.exe")

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Python25>echo
ECHO is on.

C:\Python25>echo "hello"
"hello"

C:\Python25>exit
<pywinauto.application.Application object at 0x01D64CF0>
>>>
>>>

On Wed, Jul 16, 2008 at 5:34 PM, Herrick, Kristina <kherrick-zC7DfRvBq/JWk0Htik3J/w@public.gmane.org> wrote:

I'm trying to start and use the windows command shell in a Pywinauto test. I was thinking that I could just use Pywinauto to manipulate the cmd.exe process the same way I do it with Notepad. But it doesn't seem to be doing anything at all. I searched online and didn't see anything about why a cmd shell application would be any different than any other kind of application.

 

So, what works with Notepad is:

 

self.app.start_(r"c:\windows\system32\notepad.exe")

 

Here's what I tried with cmd:

 

self.app.start_(r"c:\windows\system32\cmd.exe")

 

With Notepad, the Notepad app just starts right up. When I try it with cmd, no apps start at all. No errors, just no command window. I tried it from a test method inside Wing running in debug mode (the way I normally run my tests during the development phase). I also tried it from a python shell window inside Wing. Here's the Python shell contents:

 

Python 2.3.2 (#49, Oct  2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]

Type "help", "copyright", "credits" or "license" for more information.

>>> from pywinauto import application

>>> app = application.Application()

>>> app.start_(r"c:\windows\system32\notepad.exe")

<pywinauto.application.Application object at 0x00BCD310>

>>> app.start_(r"c:\windows\system32\cmd.exe")

Microsoft Windows XP [Version 5.1.2600]

(C) Copyright 1985-2001 Microsoft Corp.

 

C:\local_pwa\HEAD\trigbuildertest><pywinauto.application.Application object at 0x00BCD310>

>>> 

 

Note that Notepad started, but I didn't see any cmd shells start. Though it does look like it tried to start a cmd shell. So something's going on there. I don't know what it could be.

 

Any thoughts or help would be appreciated. Maybe there is another way that people use out there that I'm not thinking of?

 

Thanks,

Kristina

 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pywinauto-users mailing list
Pywinauto-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/pywinauto-users



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pywinauto-users mailing list
Pywinauto-users@...
https://lists.sourceforge.net/lists/listinfo/pywinauto-users

Gmane