Probably not news to most of you but took me ages to figure out, to run a cmd window without it closing itself use:
shellexec cmd.exe /k $$1
because you're running the /k flag on cmd.exe it won't close until cmd.exe "exits" via you closing it. As opposed to running the /k on your application, which for something like ipconfig just instantly closes