How to run exe file using xp_cmdshell
-
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
-
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
-
You cannot run exe which has GUI. You can run exe which is running in background process.
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