?
Solved

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

Posted on 2010-11-08
5
Medium Priority
?
587 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

762 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