EXE through SQl

  • Hey i am trying to run an exe using t-sql command and even through job, but it is giving me issues. But if i double click on the exe it runs fine.

    For example i created a bat file just to make a directory - mkdir d:\example

    double clicking it, a folder is created BUt through

    EXEC xp_cmdshell "D:ew.bat"

    it gives me error -

    'D:ew.bat' is not recognized as an internal or external command,

    and when i do with the job with command - @command=N'\idhimahajan\D$ew.bat',

    it gives an error on execution - Executed as user: NT Service\SQLAgent$PAXAS. The process could not be created for step 1 of job 0x2FCDDE36F160CD4688D2ACE1D748A99E (reason: Access is denied). The step failed.

    Can anyone suggest soemthing please. In actual scenario i need to call an exe file.

  • Even though doing these sorts of things are terrible to do through SQL Server, what's the actual path of batch file you're attempting to execute? It looks as though it should be D:\ew.bat or D$\ew.bat, but you're missing the backslash before "ew.bat".

  • oh yes... it is "D:ew.bat" i missed it while posting it here... but i ma trying with D:ew.bat only

  • oh its taking it as new line i guess..... /n

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

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