bat file: how to hide comp prompt

  • Thread starter Thread starter Benny
  • Start date Start date
B

Benny

I use following code to get the return value of comp

....
@echo n|comp %1 %2 >nul
IF ERRORLEVEL 1 GOTO CPY
....

but it will prompt
"Compare more files (Y/N) ?"

How can i hide the message?
 
I use following code to get the return value of comp

...
@echo n|comp %1 %2 >nul
IF ERRORLEVEL 1 GOTO CPY
...

but it will prompt
"Compare more files (Y/N) ?"
....snip

Try something along these lines:

@ECHO OFF
(ECHO/n&ECHO/n)|comp %1 %2 >NUL 2>&1
IF ERRORLEVEL GOTO CPY

That should send two "N" replies through the pipe to COMP
and 2>&1 should redirect both channels 2 and 1 to NUL and
may get rid of the COMP prompt.
 
Back
Top