Executing exe from SQl

  • Hi

    How can i execute .exe from SQL server.

    I tried with

    EXEC xp_cmdshell 'C:\WINDOWS\System32\calc.exe'

    but it goes in endless loop.

  • If you log on to the server that you are issuing the xp_cmdshell command to, you will see in the task manager that calc.exe is running. It appears to be in a loop as it waiting for either input or for the process to be terminated.

  • Thanks! It was indeed seen in the task manager.

    But if I want to call some other exe that resides in d: say

    d:ew_doc\abc.exe

    then will my command work

    exec xp_cmdshell ' d:ew_doc\abc.exe'

    will it execute abc.exe

  • Yes, it will execute. Try it out and you'll see it in task manager.

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

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