> SHELL $cmd > NUL

is not correct because > NUL is outside of the quotation ... more correct use :

shell $cmd + " >nul"
_________________________