Installing softwares using installers in Qt Application
-
wrote on 27 Apr 2014, 19:41 last edited by
Hii all..
I want to install some softwares from their .exe installers from the Qt application. For this i simply used this commands..
First Qprocess Header file is included and the following line is added after the main windows show line.
@process.start("cmd", QStringList() << "C:\CodeBlocks_setup.exe");@
But nothing is happening.. It is saying that an instance of CMD is running but no Installation wizard shows up..
But, if i enter the "C:\CodeBlocks_setup.exe" inside cmd prompt, the installation wizard shows up...
What is the problem with the Qt API above ?
-
wrote on 27 Apr 2014, 19:43 last edited by
Even as simple as
@process.start("cmd", QStringList() << "help");@
is not showing anything..But, this should output the "help" command output in cmd.
-
wrote on 27 Apr 2014, 19:54 last edited by
Why not run the installer directly?
@QProcess process;
process.start("C:\CodeBlocks_setup.exe", QStringList());@Anyway, if you want to use the command interpreter, then try:
@QProcess process;
QStringList args;
args << "/c";
args << "C:\CodeBlocks_setup.exe";
process.start("cmd.exe", args);@__
See also:
[quote]C:\Users\MuldeR>cmd /?
Starts a new instance of the Windows command interpreterCMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
[[/S] [/C | /K] string]/C Carries out the command specified by string and then terminates[/quote]
-
wrote on 27 Apr 2014, 20:12 last edited by
BTW: You may which to use "%COMSPEC%":http://en.wikipedia.org/wiki/ComSpec instead of hardcoding the path to the command interpreter ("cmd.exe"):
@const wchar_t envComSpec = _wgetenv(L"ComSpec");
const QString comSpec = QString::fromUtf16(reinterpret_cast<const ushort>(envComSpec ? envComSpec : L"cmd.exe"));
/.../
process.start(comSpec, args);@ -
wrote on 28 Apr 2014, 17:33 last edited by
Thanks MuldeR...
All of the above methods worked.. :D
I had already tried first method, but i guess i did somewhere wrong..I never heard of ComSpec... Thankyou again...
1/5