QProcess DOS command not working
-
I'm trying to invoke the Windows On-Screen Keyboard with the command:
C:\Windows\System32\osk.exeRunning this command from DOS works perfectly fine.
But when I run from with the Qt application
int exitCode = QProcess::execute( "c:/Windows/System32/osk.exe");The exit code is -2.
I have also tried to wrap this within a DOS bat script and execute this as follows:
int exitCode = QProcess::execute( "cmd /c \"w:/scripts/myscript.bat\"");And myscript.bat has:
c:\Windows\System32\osk.exeBut this gives:
'c:\Windows\System32\osk.exe' is not recognized as an internal or external command, operable program or batch file. -
I'm trying to invoke the Windows On-Screen Keyboard with the command:
C:\Windows\System32\osk.exeRunning this command from DOS works perfectly fine.
But when I run from with the Qt application
int exitCode = QProcess::execute( "c:/Windows/System32/osk.exe");The exit code is -2.
I have also tried to wrap this within a DOS bat script and execute this as follows:
int exitCode = QProcess::execute( "cmd /c \"w:/scripts/myscript.bat\"");And myscript.bat has:
c:\Windows\System32\osk.exeBut this gives:
'c:\Windows\System32\osk.exe' is not recognized as an internal or external command, operable program or batch file. -
I'm trying to invoke the Windows On-Screen Keyboard with the command:
C:\Windows\System32\osk.exeRunning this command from DOS works perfectly fine.
But when I run from with the Qt application
int exitCode = QProcess::execute( "c:/Windows/System32/osk.exe");The exit code is -2.
I have also tried to wrap this within a DOS bat script and execute this as follows:
int exitCode = QProcess::execute( "cmd /c \"w:/scripts/myscript.bat\"");And myscript.bat has:
c:\Windows\System32\osk.exeBut this gives:
'c:\Windows\System32\osk.exe' is not recognized as an internal or external command, operable program or batch file.@TGRSM
Do not you need arguments to call execute?
int QProcess::execute(const QString &program, const QStringList &arguments)
https://doc.qt.io/qt-5.15/qprocess.html#executeThe following one is run like
QStringList arguments;
arguments << "/c"
<< ""w:/scripts/myscript.bat""
int exitCode = QProcess::execute( "cmd", arguments );