xp_cmdshell and microsoft word

  • Greetings All

    I am currently working on a mail-merge document through Microsft Word and i am trying to open the document through a batch file via xp_cmdshell. When i run the batch file on its own, it works fine, i.e. it opens up the word doc and does its business, the moment i try executing the batch file via xp_cmdshell, it moans and groans. It pops up a message box saying "Cannot find file (or one of its components). Make sure..."

    Any ideas as to why this is happening?

    My understanding of xp_cmdshell is that it can execute commands at a command level.

    If it works in a .bat file, any ideas as to why it doesn't work via xp_cmdshell.

    Thanks in advance for the help guys!

  • As per BOL, xp_cmdshell uses the security context of SQLAgentCmdExec(when you are not logged in as sysadmin).

    There might be permissions issues with this account and microsoft word.

    One way to figure out the error is to login to sql*server PC with SQLAgentCmdExec account

    and try to run the same batch file directly (without using xp_cmdshell).

    This might give you the detailed error.

  • Thanks for the reply!

    Will have a squibble at it!

Viewing 3 posts - 1 through 2 (of 2 total)

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