Home ShellExecuteEx command is successful in Isapi but not CGI
 I am using Delphi Tokyo 10.2. I have the following function: function THtmlToPdfService.ExecuteShell(filename, outFilename : string) : Boolean; var shellInfo : TShellExecuteInfo; exitCode : DWORD; begin Result := false; try // Set Shell execution information FillChar(shellInfo, SizeOf(shellInfo), 0); shellInfo.cbSize := SizeOf(TShellExecuteInfo); shellInfo.fMask := SEE_MASK_NOCLOSEPROCESS; shellInfo.Wnd := 0; shellInfo.lpFile := PChar(GetHtmlDocInstallDirectory + 'htmldoc.exe'); shellInfo.lpParameters := PChar(Format(' --webpage --datadir ' + GetHtmlDocInstallDirectory + ' -f %s %s', [outFilename, filename])); shellInfo.nShow := SW_HIDE; // Run ShellExecuteEx to wait for process to complete if ShellExecuteEx(@shellInfo) then begin repeat Application.ProcessMessages; GetExitCodeProcess(shellInfo.hProcess, exitCode) ; until (exitCode <> STILL_ACTIVE); if FileExists(outFilename) then Result := true else RaiseLastOSError; end; except raise; end; end;  This, very simply, executes HTMLDoc.exe, using the filename as the source HTML file and outFilename as the target output PDF file. I have the same unit used in both an Isapi DLL and a CGI EXE, running on my localhost. I have a local test exe that calls the web services from my localhost, and when I call the Isapi service, it works just fine...the output PDF is created, and the function that calls this one returns that PDF to the user as a byte array. When I call the CGI service from the same test module, it will not create the output PDF, it simply returns: System Error. Code: 2. The system cannot find the file specified  Everything else works just fine, but it won't create the output file I need. I have tried permissions, authentication, I've tried different means of formatting the files, I even tried creating the PDF first, hoping that it was simply a matter of having the file already there, even though this doesn't matter to the Isapi service. I have verified that HTMLDoc and the source file can both be found at the point this command executes, and if I create the PDF first the service returns the blank PDF to the user, but I need the HTML file to convert properly in the CGI. Any thoughts?