I am in the middle of writing a batchfile to do a bunch of things, but I do not want any of my executions to work on a particular server, if, by chance someone were to execute this on that server.
So what I have done within the batch is exactly below. In the goto:server I just have a message stating that this batch can't be used here and it makes you go back to the menu. It works, but the problem is its working no matter what server I am on, loops me back to the menu no matter what.
Code: Select all
:ERROR
ECHO This can't be run here
pause
GOTO Menu
if "%COMPUTERNAME%"=="MYSERVERNAME"
goto:ERROR
Above is the exact syntax, seems trivial and not a difficult thing to check, but its kicking my butt, and I am new to batch scripting. I have also tried using call instead of if...
Any suggestions?
Thanks in advance!