Hello!
I am running Windows 10. I am trying to execute a command-line application (which simple outputs a text file) which is inside a folder in the current user's home folder (
C:\Users\*\). On one computer, the following works fine:
AProcess := TProcess.Create(nil);
AProcess.Executable := 'C:\Windows\System32\cmd.exe';
AProcess.Parameters.Add('/c');
AProcess.Parameters.Add('C:\Users\' + Username + '\MyFolder\App.exe >> C:\Users\' +
ComputerUsername + '\MyFolder\text_output.txt');
AProcess.Options := [poWaitOnExit];
AProcess.Execute;
However, on another computer, the program will not run, as access is denied.
A manual solution is to change directory to
MyFolder first and then run the program from the command line:
App.exe >> text_output.txt
So my question is: how can I
cd to MyFolder and then run execute
TProcess?
Thanks!