xp_cmdshell problem

  • Hi,

    i'm trying to run this command from within the SQL but i get this error

    'C:\Program' is not recognized as an internal or external command,

    operable program or batch file.

    here is my code

    DECLARE @CONVERT_HTML_TO_PDF VARCHAR(4000)
    SET @CONVERT_HTML_TO_PDF = '"C:\Program Files\Microsoft SQL Server\MSSQL15.PRI\MSSQL\monitor_binaries\wkhtmltopdf.exe" "c:\new folder\1.html" "c:\new folder\1.pdf"'
    EXEC xp_cmdshell @CONVERT_HTML_TO_PDF

    what is wrong with my code?

    THX

  • i found a solution to add cd.. && in the begging

    SET @CONVERT_HTML_TO_PDF = 'cd.. && "C:\Program Files\Microsoft SQL Server\MSSQL15.PRI\MSSQL\monitor_binaries\wkhtmltopdf.exe" "c:\new folder\1.html" "c:\new folder\1.pdf"'

  • Thanks for the update. Good to know this worked for you.

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

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