I'm trying to write a batch script that errors if port 1099 is already in use.
Unfortunately I have to write it in a DOS batch script (I cannot install anything).
I know that I can print the PID of the process hogging port 1099 manually:
netstat -aon | findstr ":1099"
But I want to be able to run that command in a batch script and exit the script with an error message if that command has any output.
I suppose at a push I could redirect the output to a temporary file and test the size of it but that seems really hacky...