mssqlfun.com
Procedure xp_cmdshell expects parameter ‘command_string’ of type ‘varchar’.
You can’t use varchar(max) with xp_cmdshell. Try a finite number (0 to 8000). varchar(max) is having capacity of 2GB & works as TEXT data type in background.