Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to run exe file using xp_cmdshell

How to run exe file using xp_cmdshell

Scheduled Pinned Locked Moved Database
databasesql-servercomsysadminhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Krushna Sahu
    wrote on last edited by
    #1

    Hello everyone, I've a exe file in C:\. I need to run it from stored proc using xp_cmdshell. Please note that I'm using SQL Server 2000. My stored proc is : Create proc callExe As EXEC master.dbo.xp_cmdshell 'C:\PrintToPDFConsole.exe' After executing this, the output is : NULL Unhandled Exception: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation at PrintToPDF.Program.Main(String[] args) NULL and the exe file did not run. Please help in this. Also, I've tried with common exe file like 'notepad.exe' like: ALTER proc callExe As EXEC master.dbo.xp_cmdshell 'notepad.exe' When I executed this, the execution is going on and not showing any output. The execution time is more that 10 mins and going on... Then I forcefully closed the isqlw.exe from Task Manager. Is that mean exe file can't be executed in sql server 2000 using xp_cmdshell ?

    --Krushna Chandra Sahu prfkrushna@gmail.com

    K 1 Reply Last reply
    0
    • K Krushna Sahu

      Hello everyone, I've a exe file in C:\. I need to run it from stored proc using xp_cmdshell. Please note that I'm using SQL Server 2000. My stored proc is : Create proc callExe As EXEC master.dbo.xp_cmdshell 'C:\PrintToPDFConsole.exe' After executing this, the output is : NULL Unhandled Exception: System.ComponentModel.Win32Exception: No application is associated with the specified file for this operation at PrintToPDF.Program.Main(String[] args) NULL and the exe file did not run. Please help in this. Also, I've tried with common exe file like 'notepad.exe' like: ALTER proc callExe As EXEC master.dbo.xp_cmdshell 'notepad.exe' When I executed this, the execution is going on and not showing any output. The execution time is more that 10 mins and going on... Then I forcefully closed the isqlw.exe from Task Manager. Is that mean exe file can't be executed in sql server 2000 using xp_cmdshell ?

      --Krushna Chandra Sahu prfkrushna@gmail.com

      K Offline
      K Offline
      knagnayak
      wrote on last edited by
      #2

      You cannot run exe which has GUI. You can run exe which is running in background process.

      K 1 Reply Last reply
      0
      • K knagnayak

        You cannot run exe which has GUI. You can run exe which is running in background process.

        K Offline
        K Offline
        Krushna Sahu
        wrote on last edited by
        #3

        Yes, I forgot to write there that the exe file does not have a GUI. It will automatically convert the any file to pdf file and save to My Document folder.

        --Krushna Chandra Sahu prfkrushna@gmail.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups