Search code examples
python-3.xpywinauto

Error 2, 'CreateProcess', 'The system cannot find the file specified.' - pywinauto


I try to run this code:

from pywinauto.application import Application
app = Application(backend="uia").start(r"C:\Users\MyUser\AppData\Local\Apps\2.0\QD7PJO40.EAZ\MyApp.exe")

I have tried adding "/", adding "\", removing "backend = uia". I verified that the app could be opened using cmd.exe. I keep getting the error:

Could not create the process ... Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')

I also read that maybe I should disable file system redirector on 64-bit systems but i don´t know how to do it or if it is going to make a difference, as this file is not located in C:\WINDOWS\system32. Please help!


Solution

  • You can workaround it this way:

    app = Application(backend="uia").start(r"cmd /c your.exe", wait_for_idle=False)
    app = Application(backend="uia").connect(path="your.exe")