Python Popen fails in compound command (PowerShell)
问题 I am trying to use Python's Popen to change my working directory and execute a command. pg = subprocess.Popen("cd c:/mydirectory ; ./runExecutable.exe --help", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) buff,buffErr = pg.communicate() However, powershell returns "The system cannot find the path specified." The path does exist. If I run pg = subprocess.Popen("cd c:/mydirectory ;", stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True) it returns the same thing.