Xp_cmdshell is an extended stored procedure which takes a dos command as a string and returns output in table format. It is disabled by default and can be enabled as shown below.
An example of using xp_cmdshell is shown below
There are speculations that xp_cmdshell shouldn’t be enabled as it’s a security risk, however it’s not a security risk if DBA knows what he/she is doing. It can be used as and when required.