View Full Version : Start a exe file with parameters
raphaelf
16th June 2008, 10:15
Hello Everybody,
i am using a exe file to push some software to clients..
now i am using a bat file with some parameters like:
psexec.exe \\hostname -u etrust - p etrust01 \\hostname\c$\notes.exe
My question: its possible to run this exe with my parameters without uing a bat file or dos?
If yes it would be very nice..
Thnanks a lot for a answer :o
Im trying like this:
void MainWindow::startpsexec()
{
QStringList list;
list << "\\\\stchps426 " << "-u " << "etrust " << "-p " << "etrust01 " << "-i " << "\\\\stchps426\\c$\\notes.exe";
QProcess process;
process.execute("psexec.exe", list);
but is not working
rajeshs
16th June 2008, 11:53
QStringList list;
list << "\\\\stchps426 " << "-u " << "etrust " << "-p " << "etrust01 " << "-i " << "\\\\stchps426\\c$\\notes.exe";
QProcess process
process.execute("psexec.exe", list);
Try this ,
QProcess *process = new QProcess(this);
process->start("psexec.exe \\hostname -u etrust - p etrust01 \\hostname\c$\notes.exe");
raphaelf
16th June 2008, 12:03
Hi :o
this is not working:
QProcess *process = new QProcess(this);
process->start("psexec.exe \\stchps426 -u etrust -p etrust01 -i \\stchps426\c$\notes.exe");
but if i open a dos window and write this it works:
psexec.exe \\stchps426 -u etrust -p etrust01 -i \\stchps426\c$\notes.exe
Why is not working? :o
im running winxp and qt 4
rajeshs
16th June 2008, 12:41
are u geting any error ?
or
what's happening when u execute this code?
rajeshs
16th June 2008, 12:53
If this is running through command prompt try this
QProcess *process = new QProcess(this);
process->start("cmd /C psexec.exe \\hostname -u etrust - p etrust01 \\hostname\c$\notes.exe");
__
Regards,
Rajesh.S
raphaelf
16th June 2008, 13:23
Hi,
i get no error.
if i run this it happens notthing:
QProcess *process = new QProcess(this);
process->start("psexec.exe \\stchps426 -u etrust -p etrust01 -i \\stchps426\c$\notes.exe");
If i run this, i it happens nothing:
process->start("cmd /C psexec.exe \\hostname -u etrust - p etrust01 \\hostname\c$\notes.exe");
If i run this i can see in task manager that psexec run quick:
..
process->start("psexec.exe");
I dont know what to do now
Conel
16th June 2008, 14:03
Instead of
"psexec.exe \\stchps426 -u etrust -p etrust01 -i \\stchps426\c$\notes.exe"
try
"psexec.exe \\\\stchps426 -u etrust -p etrust01 -i \\\\stchps426\\c$\\notes.exe"
And you may use static method QProcess::startDetached() instead of QProcess::start(). This does not require QProcess object creation.
raphaelf
16th June 2008, 14:19
It works now..
but its not possible to run this psexec.exe in hide modus?
Because when i start psexec a dos window opens..
Its possible to hide this?
great job thanks forwarding
Conel
16th June 2008, 15:23
but its not possible to run this psexec.exe in hide modus?
Because when i start psexec a dos window opens..
Its possible to hide this?
QString exePath = "psexec.exe";
QString arguments = "\\\\stchps426 -u etrust -p etrust01 -i \\\\stchps426\\c$\\notes.exe";
#ifdef Q_OS_WIN32
ShellExecuteW(NULL, NULL, (LPCWSTR)exePath.toStdWString().data(), (LPCWSTR)arguments.toStdWString().data(), NULL, SW_HIDE);
#endif
:)
raphaelf
16th June 2008, 16:10
I get error on compiling:
LPCWSTR, SW_HIDE and ShellExecuteW undeclared
:o
I get error on compiling:
LPCWSTR, SW_HIDE and ShellExecuteW undeclared
:o
So include the <windows.h> (or <qt_windows.h>) header. If that's not enough, then lookup ShellExecute on MSDN to see which header file to include.
raphaelf
17th June 2008, 10:11
Hi All,
THANK YOU VERY MUCH!!! :D :D
SOLVED!!!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.