Solved @ECHO OFF won't suppress XCOPY echo??

May 12, 2009 at 21:43:01
Specs: Windows XP, 3gb
Folks,

Am creating a bat file in XP and putting a shortcut to it on the desktop.

It is used to backup an entire directory, as needed.

@ECHO OFF (or %ECHO OFF) works great for suppressing the display of any subsequent commands....Except for XCOPY, for some reason.

When using XCOPY to copy the entire directory quickly, the cmd window displays all the file names as they are being copied...as if the @ECHO OFF was not even there.

It works fine suppressing the display of all the other commands....just not XCOPY.

Is there some reason for this....or am I doing something incorrectly?

(the bat runs fine otherwise)

Thanks

> PLEASE HELP OTHERS - Report back what did/didn't work for those referencing this thread.<


See More: @ECHO OFF wont suppress XCOPY echo??

Report •


#1
May 13, 2009 at 00:45:47
@echo off is a command for the Command Interpreter only to suppress displaying commands, not for Xcopy. Are you using the /Q switch with Xcopy?

Report •

#2
May 13, 2009 at 01:39:43
I think I have seen this happen before, is the xcopy command in a code block(inside brackets, like this comment) by any chance?

Try:

@xcopy .......

If it is a code block then you can also try:

@(
......


Report •

#3
May 13, 2009 at 02:24:10
✔ Best Answer
Tried a few at the command prompt, > nul seems the best option.

←C:\>xcopy trial.bat %temp%
C:trial.bat
1 File(s) copied

←C:\>xcopy /q trial.bat %temp%
1 File(s) copied

←C:\>xcopy trial.bat %temp% > nul -<----- Best option?

←C:\>@xcopy trial.bat %temp%
C:trial.bat
1 File(s) copied

←C:\>@(xcopy trial.bat %temp%)
C:trial.bat
1 File(s) copied



Report •

Related Solutions

#4
May 13, 2009 at 02:54:32
Ok I've tracked down the script I wrote that came to mind:

::List files modified since date on drive %dl%...
@ECHO OFF
set dl=c
set mdy=5-13-09
(
xcopy %dl%:\ %dl%:\fake /l /i /f /d:%mdy%
for /f "delims=" %%a in ('dir %dl%:\ /ad/b') do @xcopy "%dl%:\%%a" %dl%:\fake /l /i /s /f /d:%mdy%
)|for /f "delims=^>" %%b in ('find "\"') do @(
set fn=%%b
call set fn="%%fn:~0,-3%%"
call echo %%fn%%
)
pause

Try it with and without the extra @'s on the xcopy or code block, removing either yields unexpected results for me. The first 5 lines with only the xcopy's @ removed and most of the output without the @ on the code block.

Even still I agree that redirecting to nul is probably the best way to go and what was happening in the above script probably has lttle to do with this thread.....


Report •

#5
May 13, 2009 at 12:08:20

Thanks very much for the responses.

I feel kinda a little silly here...

I've used xcopy some...but have never really read through all the switches...and should have.

The /Q which does suppress the listing of file names just fine. Thanks Gari.

I did notice, though, after copying...it does still display the summary total (files copied) message.

Did try the others (except Resp 4...not yet )

I don't think that was mentioned in any of the switch descriptions.

Has anyone been able to suppress that last line?

-Thanks
-------------------------------------------------------------

Here is the current batch:

@echo off
echo.
echo. PLEASE WAIT WHILE FILES ARE BACKED UP
echo.
xcopy c:\mystorage\*.* e:\backup /s/y/q
echo.
echo. ** BACKUP COMPLETE - THANK YOU **
echo.
pause
exit

Results in:

PLEASE WAIT WHILE FILES ARE BACKED UP

218 File(s) copied

** BACKUP COMPLETE - THANK YOU **

Press any key to continue...

> PLEASE HELP OTHERS - Report back what did/didn't work for those referencing this thread.<


Report •

#6
May 13, 2009 at 14:33:23
No guarantees but try redirecting Xcopy advisory output to the nul device.

e.g.
xcopy c:\mystorage\*.* e:\backup /s/y/q > nul

Val.


Report •


Ask Question