QProcess not run "cmd.exe" command and "cmd.exe" not run .bat file.
Solved
Qt for Python
-
Please help me.
p = QProcess() def _read(): print(p.readAllStandardOutput()) print(p.readAllStandardError()) p.readyReadStandardOutput.connect(_read) 1. p.start( 'tasklist') ### result is good 2. p.start('cmd', ['tasklist | findstr "adb"']) ### reuslt is bad nothing, # reuslt: b'Microsoft Windows [Version 10.0.22000.556]\r\n(c) Microsoft Corporation. All rights reserved.\r\n\r\nC:\\Users\\User\\project\\autotest_tools\\external_tool\\win_shells>' 3. p.start('tasklist', ['|', 'findstr', 'adb']) ### result is bad, noting. not run _read() 4. p.start('cmd', ['C:/Users/....../shells/test.bat']) # result is bad, nothing , result is to "2" ------test.bat------ echo "name:jiajintao" but, run test.bat on windows cmd.exe is good.
windows11, pyqt6
I don't know what to do
I'm not good at English please don't mind -
QProcess not run "cmd.exe"
Your code does not attempt to run
cmd.exe
and "cmd.exe" not run .bat file
It does. You do not run
cmd.exe
, and there is no.bat
file involved here anyway.Try to write a proper question, which relates to whatever code you show.