Syntax
xp_cmdshell {'command_string'} [, no_output]Arguments
'command_string'Is the command string to execute at the operating-system command shell. command_string is varchar(255) or nvarchar(4000), with no default. command_string cannot contain more than one set of double quotation s. A single pair of quotation s is necessary if any spaces are present in the file paths or program names referenced by command_string. If you have trouble with embedded spaces, consider using FAT 8.3 file names as a workaround.no_outputIs an optional parameter executing the given command_string, and does not return any output to the client.Return Code Values
0 (success) or 1 (failure)Result Sets
Executing this xp_cmdshell statement returns a directory listing of the current directory.xp_cmdshell 'dir *.exe'