Start a exe file with parameters
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:
Code:
void MainWindow::startpsexec()
{
list << "\\\\stchps426 " << "-u " << "etrust " << "-p " << "etrust01 " << "-i " << "\\\\stchps426\\c$\\notes.exe";
process.execute("psexec.exe", list);
but is not working
Re: Start a exe file with parameters
Quote:
Code:
list << "\\\\stchps426 " << "-u " << "etrust " << "-p " << "etrust01 " << "-i " << "\\\\stchps426\\c$\\notes.exe";
process.execute("psexec.exe", list);
Try this ,
Code:
process->start("psexec.exe \\hostname -u etrust - p etrust01 \\hostname\c$\notes.exe");
Re: Start a exe file with parameters
Hi :o
this is not working:
Code:
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:
Code:
psexec.exe \\stchps426 -u etrust -p etrust01 -i \\stchps426\c$\notes.exe
Why is not working? :o
im running winxp and qt 4
Re: Start a exe file with parameters
are u geting any error ?
or
what's happening when u execute this code?
Re: Start a exe file with parameters
If this is running through command prompt try this
Code:
process->start("cmd /C psexec.exe \\hostname -u etrust - p etrust01 \\hostname\c$\notes.exe");
__
Regards,
Rajesh.S
Re: Start a exe file with parameters
Hi,
i get no error.
if i run this it happens notthing:
Code:
process->start("psexec.exe \\stchps426 -u etrust -p etrust01 -i \\stchps426\c$\notes.exe");
If i run this, i it happens nothing:
Code:
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:
Code:
..
process->start("psexec.exe");
I dont know what to do now
Re: Start a exe file with parameters
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.
Re: Start a exe file with parameters
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
Re: Start a exe file with parameters
Quote:
Originally Posted by
raphaelf
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?
Code:
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
:)
Re: Start a exe file with parameters
I get error on compiling:
LPCWSTR, SW_HIDE and ShellExecuteW undeclared
:o
Re: Start a exe file with parameters
Quote:
Originally Posted by
raphaelf
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.
Re: Start a exe file with parameters
Hi All,
THANK YOU VERY MUCH!!! :D :D
SOLVED!!!