Deeto Posted January 6, 2011 Share Posted January 6, 2011 I can create the WScript object - I am not having a permissions error. The problem is I'm trying to call a BAT file and what was working on WinXP no longer works on Win Server 2003.I'm running IIS with anonymous access but am using a specific local acct (not IUSR). This account has full access to the BAT, EXE and dir where it's located.Other WScript shell scripts are working, just not the call to this BAT. The BAT does work from command line, so I assume this is an acct issue but I can't figure out where. Any thoughts?Here's the code: Set WshShell = CreateObject("WScript.Shell")Set WshExec = WshShell.Exec("C:\pdf2text.bat " & filename) 'where filename is the name of a PDF file in the FSpdftext = WshExec.StdOut.ReadAll'pdftext should now hold the text content inside the PDF filename Here's the BAT code: CD C:\Inetpub\wwwroot\HCForum\uploadfilespdftotext.exe -nopgbrk -eol dos %1 -'where %1 is the filename arg passed in, and dash (-) causes the result to be sent to StdOut Thanks in advance for any advice! Link to comment Share on other sites More sharing options...
justsomeguy Posted January 6, 2011 Share Posted January 6, 2011 What happens when you run that? Link to comment Share on other sites More sharing options...
Deeto Posted January 7, 2011 Author Share Posted January 7, 2011 running the BAT directly works no problem. For some reason, I cannot call a BAT from WScript.Even if I change the content of the BAT to:MKDIR C:\HELLOit still doesn't run. No errors, and if I set the exec to a var the result is 0, which means that it executed successfully.I'm totally confused. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 7, 2011 Share Posted January 7, 2011 If it were a permission issue then it should give an error indicating that. Why don't you run the exe directly? Link to comment Share on other sites More sharing options...
Deeto Posted January 7, 2011 Author Share Posted January 7, 2011 I'd love to, but this EXE requires it run in the context of the appropriate directory. In other words, I cannot run it as:C:\Inetpub\wwwroot\HCForum\uploadfiles\pdftotext.exe -eol dos -nopgbrk C:\Inetpub\wwwroot\HCForum\uploadfiles\[filename] -The only syntax that works is:pdftotext.exe -eol dos -nopgbrk [filename] -which requires it be run from the correct directory.Are there permissions I can update in DCOMCONFIG to allow my IIS user acct to execute WSH bat files? I had to make these changes so the server would create WORD.APPLICATION and EXCEL.APPLICATION instances. I'm not sure what COM I would need to modify for WSH though. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 7, 2011 Share Posted January 7, 2011 I'm not sure about that, I haven't had to do that before. Make sure the account has permission for the specific batch file and the specific exe. I'm not sure how Windows would classify a batch file or executable though, other than by those terms. Link to comment Share on other sites More sharing options...
Deeto Posted January 9, 2011 Author Share Posted January 9, 2011 I gave the acct correct privs to BAT and EXEAre you sure there's no Windows Scripting COM I should mess with? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 9, 2011 Share Posted January 9, 2011 No, I'm not sure, I haven't messed around much with that type of thing. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.