June 6, 2012 at 6:57 am
The following indicates that xp_cmdshell works like expected:
declare @sqlcmd varchar(200)
SET @sqlcmd = 'dir d:\runtime\SomeExec.exe'
EXEC master.dbo.xp_cmdshell @sqlcmd
giving output that indicates the .exe is in the right place
The executable runs from a cmd box just fine..
declare @sqlcmd varchar(200)
SET @sqlcmd = 'd:\runtime\SomeExec.exe'
EXEC master.dbo.xp_cmdshell @sqlcmd
would supposedly fire the executable, but nothing happens, no error is returned, nada
What am I missing?
June 6, 2012 at 7:02 am
What is supposed to happen? What your expected result from executable?
June 6, 2012 at 7:06 am
details are in order, i think.
are you really just running 'dir d:\runtime\SomeExec.exe' (directory!) or are you EXECUTING 'd:\runtime\SomeExec.exe'
how do you know "nothing" happened?
what does the executable do?
does it return any results via a command line?
does the program close itself automatically after running?
is it possible the program raises a messagebox/Ok that cannot be interacted with ?
If you were to run notepad via cmdShell, an instance of it would sit open in the processes, but there would be no user interaction possible to close it...you'd have to kill the process .
declare @sqlcmd varchar(200)
SET @sqlcmd = notepad.exe'
EXEC master.dbo.xp_cmdshell @sqlcmd
Lowell
June 6, 2012 at 8:23 am
Lowell (6/6/2012)
details are in order, i think.are you really just running 'dir d:\runtime\SomeExec.exe' (directory!) or are you EXECUTING 'd:\runtime\SomeExec.exe'
The 'dir' version just made clear that xp_cmdshell is working
how do you know "nothing" happened?
The executable creates a table in a database and loads data into the table..
does it return any results via a command line?
Everything works fine from a command line
does the program close itself automatically after running?
Runs in the background..
is it possible the program raises a messagebox/Ok that cannot be interacted with ?
No, no input required..
From what I gathered It is required to start up a cmd box in the code itself:
http://binaryworld.net/Main/CodeDetail.aspx?CodeId=4014
It is not helping either by using a . bat file though
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply