I make a program for myself (C++, RAD Studio), I am an administrator, not a programmer.
I can't access a remote computer via psexec by pressing a button.
This variant works via 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);
gives out that "C:\Windows\System32\PsExec.exe" is not an internal or external command, executable program or batch file. PsExec is exactly there, I copy the path with right key + Shift.
Tried to do through system, WinExec, write path with quotes, just run psexec - either just empty CMD window, or the error above. ipconfig from the code works: the window with the executed command appears and you can write further commands. As if at startup the whole path is taken as the name of the program and searches in the system variables.