You can not run Notepad or any other program with a GUI because processes started via xp_cmdshell run as a background process and are therefore not able to show a GUI. See
here[
^]. The execution of the command will just "hang".
If you want to run some other non-GUI program, you would have to include a space after
'C:\Execute.bat'
and quote the file path in double-quotes because it contains a space:
SET @Variable = '"C:\Microsoft Dynamics\SL\Applications\LogFacturacion\LOGERROR002211.txt"'
SET @CMDSQL = 'C:\Execute.bat ' + @Variable