1

Here is my batch sample code. What should I do if I would like to have an automatic "Enter" key once an input is detected (using scanner or keyboard input)? Set the Enter at the scanner is not possible since we need to follow the format on many applications that we are currently in use.

cls
set order=none
set /p order= Scan order number: **[How to add auto ENTER key here]**
for /f "tokens=2,4 delims=|~" %%a in ("%order%") do set code=%%a-%%b
@echo %code% >> "C:\Record.txt"
echo Records are saved.
Laurel
  • 5,965
  • 14
  • 31
  • 57
  • Since immediate automatic input detection means that you only have time to hit one key before the rest of the code activates, I recommend looking into the `choice` command. http://ss64.com/nt/choice.html – SomethingDark Mar 04 '16 at 03:49
  • I agree with @SomethingDark, you would need to look into choice command. – NizonRox Mar 04 '16 at 07:29
  • Are you asking how to input the order number not from keyboard but by output of another batch file or such? – wilx Mar 04 '16 at 08:06
  • Which characters are you receiving from the scanner? Is it case sensitive? Btw. `set /p` will not work here – jeb Mar 04 '16 at 08:19
  • If there is a logic for the end of the scanner input you could use choice or the xcopy technic [SO:batch - color input by user](http://stackoverflow.com/a/15160168/463115) – jeb Mar 04 '16 at 08:33
  • Maybe the pipe i.e `|` maybe helpful? – Mr.Helpy Mar 12 '16 at 07:55

0 Answers0