Solved

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

Posted on 2010-11-08
5
579 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
  • 4
5 Comments
 
LVL 16

Accepted Solution

by:
EvilPostIt earned 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now