Running batch file with xp_cmdshell SQL Server 2005 and cannot open file from batch

  • I am using the xp_cmdshell to run a batch file that is trying to open the Adobe Acrobat Reader.

    When I run the batch file in the command prompt, it opens perfectly.

    When I run it in SQL with xp_cmdshell, it returns the contents fine, and I notice it tries to open Acrobat, but it is under the username "system". And I cannot get it to load in a visible area, and for some reason it doesnt seem to load properly under system.

    Any ideas? Any Suggestions?

    Please advise.

    Marco

    ------------- File --------------

    PATH = "C:\Progra~1\Adobe\CurrentReader\Reader\"

    START /WAIT AcroRd32.exe %1

    ------------- File --------------

    Note that I have verified and %1 is being passed in a valid filepath

  • Hi,

    Why are you trying to open Adobe Acrobat from SQL Server?

    Thanks,

    Phillip Cox

    MCITP - DBAdmin

  • Actually, this is the tail end of a really long story.

    We have an Intranet Application running here and they want a certain form to automatically print when they hit save. This document is generated in PDF format. Knowing all of the security limitations of the browser not allowing the application to print from the browser silently, we used the fpdf class to generate a pdf that contains JavaScript that will force a print. The only downfall to this is that it requires Acrobat to load in order for the JavaScript to run.

  • Hi,

    Ok, but this is not the best strategy. It would be a better idea to call Adobe Acrobat from web application NOT SQL Server. Your application should be able to use the API to call Acrobat and use print method.

    Thanks,

    Phillip Cox

    MCITP - DBAdmin

  • I appreciate that, but I am hoping that the route I am taking to accomplish this would not become the topic of this thread. As I am sure you have been faced with in the past, there are many limitations being put on my by the people that are "running" the project. And despite my best efforts to persuade them into better methodology, the path I have left in front of me - has led me here.

  • Here is the problem you are faced with, trying to open an application that needs to interact with a desktop where you don't have a desktop to interact with.

    The path you are heading down, IMHO, is a dead end.

    😎

  • That is actually what I feared. I have tried to have it load to the browser, but it is apparently, above all else, important that the user not have to click "Print" or even see it, they just want it to walk over the the printer - load the paper and go. -- clearly that is a slight exaggeration, but you get the point. This has of course, run us into all sorts of walls at the end of all of our possibilities. Perhaps I will just write a VB program that scans the directory, and write the pdfs into there.

    Thanks for all of your help.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply