1.

Solve : Batch File to process the "Enter" key?

Answer»

I need a batch file that will process the key after a command takes place that requires the Enter key to be pressed.

In this case, the batch file processes the unregistration of a dll and/or ocx file and the re-registration of others using "REGSVR /u" or without the /u. Then, the batch file call the underlying program that needs those dll's or ocx's.

Each time the unregister or register process occurs in the current batch file, the computer lists a message about it being successful (or rarely unsuccessful) and needing to press . HOWEVER, with the correct commands, and the need to use this often on a variety of files for each line of the batch file that uses the unregister and re-register commands, this is time-consuming. I need to automate this.

The normal syntax would have the "
What is the content of the Enter.Txt file that is the equivalent of the key or the "Carriage Return" command. However, I haven't been able to get it to work.

Any thoughts or suggestions would be appreciated.In the case of Enter, it would just be a plain (notepad) TEXT file with a single blank line in

Rather than create the file and do

MyCommand
you could do

Echo. | MyCommand

GrahamI tried the suggestions Graham, but neither worked. First I tried the
Echo. | MyCommand
No good, it didn't change any behavior, and STILL required pressing enter for each line.

Then I tried editing the text file Enter.Txt to only inlcude a blank line created by entering Enter. (I had tried that previously before posting this question.) It didn't work.

Again, the syntax that I had been using in the batch file is:
regsvr32 "C:\Program Files\Common Files\ MySpecial.ocx" /u and
regsvr32 "C:\Program Files\Common Files\MyNewSpecial.ocx" Program.Exe

I had tried your suggestion as the following:

echo. | regsvr32 "C:\Program Files\Common Files\ . . .ocx"
and
echo. | regsvr32 "C:\Program Files\Common Files\ . . .ocx" /u

Do you or does someone else have any other ideas?

Thanks for your efforts.
Not all programs are programmed to take input from the pipe. You may be SOL on this. I even tried this with a windows script, but the problem is that when the message is sent to the screen, the program is still running and the wait for input is not on the stdin device.

You could use the /s switch to rid yourself of the message boxes, but the errorlevel remains zero WHETHER it's successful or not; not helpful if you need to test the result of the registration.

Thanks for trying.
One final thing. A friend told me the fix that made this work. It turns out that REGSVR32.EXE includes several switches, one of which is /s. It stands for "SILENT." In this case, it means that the system does NOT wait for input from the keyboard.

Thus, all that was needed was to add /s to the end of each line for REGSVR32.EXE.

I should have, but didn't think to check REGSVR32.EXE /? which would have listed the switch options. Whether I would have understood that "silent" means that no input is needed is another thing.

Thanks again.



Discussion

No Comment Found