I am trying to automate the execution of several commands currently carried out manually in routine server maintenance sessions. Some of the commands would prompt the user for input mid-execution, and would pause execution until the user enter said input. My intent is for the script to execute the commands, detect when cmd prompts for input, then notifies the user to enter it, which the script will write into stdin.
Currently, I don't know how to detect said prompts. First, listening for specific strings from stdout isn't feasible for two reasons: 1) These prompts do not occur everytime I execute the script - e.g. chkdsk on C:\ could require user input when I execute it this month, but would complete smoothly without needing user input when I execute the script next month. It's not deterministic. 2) The script is executing different commands - not just chkdsk - and consequently different possible prompt messages. Second, implementing an infinite loop to listen for pauses in stdout wouldn't work, because some commands (again, such as chkdsk) can be running for extended lengths of time without printing any output, so this implementation would risk triggering false positives.
How do I accurately listen for cmd asking for user input, regardless of what prompt message is printed out?
Note: I'm using AutoIT v184.108.40.206, and the script will be run in a Win2K environment.