Thanks for reading / helping. On an old win2003 server, in this scenario:
Const WshRunning = 0
Const WshFinished = 1
Const WshFailed = 2
Dim shell, exec, strOutput
Set shell = CreateObject("WScript.Shell")
Set exec = shell.Exec("cmd.exe /c echo hello world") ' << this line changes in each example
If exec.Status = WshFailed Then
strOutput = exec.StdErr.ReadAll
Else
strOutput = exec.StdOut.ReadAll
End If
response.write strOutput
I get the perfect response: "Helllo world", both in CMD and in ASP. also with
Set exec = shell.Exec("cmd.exe /c ping 127.0.0.1")
Again, perfect response, both in CMD and in ASP.
But I need to know how big a pdf is. So I tried 2 tools:
Set exec = shell.Exec("cmd.exe /c qpdf --show-npages c:\utils\b.pdf")
Set exec = shell.Exec("cmd.exe /c pdfinfo -v c:\utils\b.pdf")
Both work in cmd, it outputs what I want to know, but I get no response in asp. Both tools have IUSR rights. What am I missing? Thanks a lot,
Alex
My comments below properly readable:
Good point. I forgot to mention that I did include in the system variables:
var: pdfinfo val: c:\Program Files\Utils\xpdf\pdfinfo.exe
var: qpdf val: c:\WINDOWS\system32\qpdf.exe
relevant part of PATH:
%SystemRoot%\system32;
C:\Program Files\Utils\xpdf\;
C:\utils\;
But, funny enough:
Set exec = shell.Exec("cmd.exe /c pdfinfo -meta c:\utils\b.pdf")
CMD.exe starts, that's all. But, on your suggestion, I tried
Set exec = shell.Exec("cmd.exe /c ""c:\Program Files\Utils\xpdf\pdfinfo.exe"" -meta c:\utils\b.pdf")
as well: (sometimes, not all the time) Process Explorer shows pdfinfo being started up by cmd as well. Still no response to ASP though. Thank you for helping :-)
The problem has finally been solved. Can't say for 100% certain what solved it, but for anyone reading this: this code
was correct but not working. It started to work after I changed:
qpdf.exe ( in system32) had full control on IUSR, qpdf13.dll did not. Changed.
C:\utils\b.pdf had full control on IUSR, but the folder C:\utils did not. Changed the test to folder C:\test\ which did have Full Control on IUSR.
restarted just in case.
Thank you for the help!