I'm not aware of a way to do this in batch code. REXX and VBScript have methods (charin(), and charAt(index) respectively) that you might put in a function. In general you have to convert each character you read from stdin to hex or decimal, check if it's the enter key, and then continue with your script.
Other script languages most likely also have functions to accomplish this.
Batch language is extremely limited and was not designed for scripting in any real sense. If you have a Windows machine, Google for script languages and choose one you like. Windows also comes with two free script languages, VBscript and JScript. Check the Help and Support on your machine for more info.
Good luck. 8-)