Hi Jim,
Thanks for your post in Microsoft Community.
I understand that you are having problems with the created .cmd script not working.
We're sorry that this question is beyond our support scope, the best place to get script-related support is Microsoft Docs.
There are experts who are more specialized in CMD and Powershell. You can discuss with them there and get an accurate answer.
Best regards!
Kirk | Microsoft Community Support Specialist