0

I can run this SQL command just fine from SSMS, and the .bat file runs:

EXECUTE xp_cmdshell 'C:\ReportPrinting\KarlTest\test.bat @TrxOid'

I put it into a stored procedure and, after getting past a lot of permission issues, the stored procedure executes just fine. Hence, I know that xp_cmndshell is now actually being performed.

However, the batch file does not actually run. So it appears that SQL Server is properly sending the command to Windows, but Windows doesn't run it.

What do I need to be considering?

Karl
  • 13
  • 5
  • 1
    What makes you think that it isn't run? I assume `@TrxOid` is meant to be a T-SQL variable. As it is, it isn't passing the T-SQL variable value in. – Nick.Mc Nov 04 '17 at 00:45

1 Answers1

0

That was the problem. Here's what fixed it:

select @message = 'C:\LabelPrinting\ReportPrinting\Parts\PostSubmitAdjustment.bat '+ cast(@TrxOid as nvarchar(100))
        EXECUTE xp_cmdshell @message
Karl
  • 13
  • 5