I am trying to use a shellandwait command on a net use batch file. However if the net use information is incorrect and it is asking for a password the cmd window will never close because it's waiting for input

I have tried using timers but can't seem to place it right, anyone have any ideas on how to achieve what I am looking for?