Hi Folks -
Happy Sunday!
There are a few services I start that require the CMD Window stay open. With that said, I need to wait until a certain string is displayed on screen before proceeding to the next step. I'm building a script to automate this process so I was wondering if there was a way to read a CMD for a specific string?
The string is : <Server started in RUNNING mode>
I can start the CMD with a specific title if that helps...
Thank you!
Read CMD Window for specific string?
Moderator: DosItHelp
Re: Read CMD Window for specific string?
The message certainly comes from a command line utility that you run in the batch file. You could run it in a FOR /F loop to process its output or you can redirect its output to a file that you can observe.
Steffen
Steffen
Re: Read CMD Window for specific string?
Thank you, Steffen.
What I will is FOR loop as when I try to direct the following into a log file, it doesn't work:
THanks!
What I will is FOR loop as when I try to direct the following into a log file, it doesn't work:
Code: Select all
start "path\script.cmd" >>%LOGFILE%
THanks!
Re: Read CMD Window for specific string?
The START command runs your script asynchronously in a new cmd process. That means after the START command was executed the parent batch process immediatelly resumes with the next comand without waiting for the child process (or any of its output). You have to write your log file from within the child process. You may observe the content of this file from within the parent process. But that sounds all overcomplicated to me and indicates a general problem with the design of your code.
Steffen
Steffen