Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to Run .NET Exe File with Argument using XP_Cmdshell Store Procedure ?

Posted on 2010-11-08
5
Medium Priority
?
592 Views
Last Modified: 2012-05-10
Hi Experts--

I have one .NET Exe which is placed in Shared Directory.

I am trying to Execute this .NET Exe using XP_CmdShell Store Procedure with One Argument.

I am refering UNC path for Share Drive directory where my .NET EXE seats.

Below is the Script I am using, but till now No Luck.

Declare @PathTest Varchar(200)
Declare @ExePath Varchar(200)
Set @ExePath = '\\Common\pdf.exe'             <----Shared drive Directory location
Set @PathTest = @ExePath + 'MyProcess'  <------'MyProcess' is the Arguemnt Parameter    
execute master..xp_cmdshell @PathTest

Any kind of Help or suggestions appreciated.

Thanks.

0
Comment
Question by:SQLNewBieUSA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 16

Accepted Solution

by:
EvilPostIt earned 2000 total points
ID: 34085619
Declare @PathTest nVarchar(200)
Declare @ExePath nVarchar(200)
Set @ExePath = '\\Common\pdf.exe '            
Set @PathTest = @ExePath + 'MyProcess'
execute master..xp_cmdshell @PathTest
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34085622
Try that.
0
 

Author Comment

by:SQLNewBieUSA
ID: 34087432
EvilPostIt--

I tryied your solution, but sorry to say NO Luck yet.

Can you please provide me other suggestions or ideas ?

Thanks.
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34087581
Declare @PathTest nVarchar(200)
Declare @ExePath nVarchar(200)
Set @ExePath = '\\Common\pdf.exe '            
Set @PathTest = @ExePath + 'MyProcess'
Print @pathtest

Run this and paste the output into a run window. Preferably logged in as the SQL server service.

Does the xp_cmdshell return any output at all?
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34091534
Also i take it that this is not supposed to be opening the application for a user as this will not work if that is the case. xp_cmd_shell runs as a non-interactive background task under the sql service account.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question