0

I am trying to execute an .exe file from a SQL query. I am not sure whether the output I receive is valid.

This is my query:

exec master..xp_cmdshell 'dir C:\Users\My_PC\Desktop\Items\dist\runfile.exe'

And I get the following result:

Volume in drive C has no label.
Volume Serial Number is 1256-8E4B
NULL
 Directory of C:\Users\My_PC\Desktop\Items\dist
NULL
13/06/2016  17:08         6,794,192 runfile.exe
               1 File(s)      6,794,192 bytes
               0 Dir(s)  10,165,284,864 bytes free
NULL

Ideally, executing the runfile.exe should invoke the command prompt. But it isn't. Any help or suggestion would be appreciated.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
NeelDeveloper
  • 139
  • 1
  • 15

1 Answers1

2

That was a good test. You have proved your path is working, you can run a command and receive output.

Now remove dir to run the command.

exec master..xp_cmdshell 'C:\Users\My_PC\Desktop\Items\dist\runfile.exe'
Mike
  • 1,645
  • 3
  • 13
  • 21