Answer the question
In order to leave comments, you need to log in
How to run PsExec from a C++ application showing a console window?
I am making a program for myself (C++, RAD Studio), I am an admin, not a programmer.
It is not possible to implement access to a remote computer through psexec at the click of a button.
This option works through Win + R: cmd.exe /k C:\Windows\System32\PsExec.exe \\COMP cmd.exe
But it is not possible to implement it in the code. For example
ShellExecute(NULL,L"open",L"C:\\Windows\\System32\\cmd.exe",L"/k C:\\Windows\\System32\\PsExec.exe \\\\COMP cmd .exe",0,SW_SHOWNORMAL);
shows that "C:\Windows\System32\PsExec.exe" is not an internal or external command, operable program or batch file. PsExec is definitely there, I copy the path with the right key + Shift.
I tried to do it through system, WinExec, the way to write with quotes, just run psexec - either just an empty CMD window, or the error above. At the same time, ipconfig from the code works: a window with the executed command appears and you can write commands further. As if at startup, the entire path is perceived as the name of the program and the system variables are searched.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question