Solved

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

Posted on 2010-11-08
5
582 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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