Link to home
Start Free TrialLog in
Avatar of SQLNewBieUSA
SQLNewBieUSA

asked on

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

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.

ASKER CERTIFIED SOLUTION
Avatar of EvilPostIt
EvilPostIt
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try that.
Avatar of SQLNewBieUSA
SQLNewBieUSA

ASKER

EvilPostIt--

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

Can you please provide me other suggestions or ideas ?

Thanks.
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?
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.