Computing.Net > Forums > Programming > @ECHO OFF won't suppress XCOPY echo??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

@ECHO OFF won't suppress XCOPY echo??

Reply to Message Icon

Name: kev100
Date: May 12, 2009 at 21:43:01 Pacific
OS: Windows XP
CPU/Ram: 3gb
Subcategory: Batch
Comment:

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.<



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: May 13, 2009 at 00:45:47 Pacific
Reply:

@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?


0

Response Number 2
Name: Judago
Date: May 13, 2009 at 01:39:43 Pacific
Reply:

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:

@(
......


0

Response Number 3
Name: Valerie (by Garibaldi)
Date: May 13, 2009 at 02:24:10 Pacific
Reply:

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



0

Response Number 4
Name: Judago
Date: May 13, 2009 at 02:54:32 Pacific
Reply:

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.....


0

Response Number 5
Name: kev100
Date: May 13, 2009 at 12:08:20 Pacific
Reply:


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.<


0

Related Posts

See More



Response Number 6
Name: Valerie (by Garibaldi)
Date: May 13, 2009 at 14:33:23 Pacific
Reply:

No guarantees but try redirecting Xcopy advisory output to the nul device.

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

Val.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: @ECHO OFF won't suppress XCOPY echo??

vb scripts won't run www.computing.net/answers/programming/vb-scripts-wont-run/2295.html

Batch File Loop - Help www.computing.net/answers/programming/batch-file-loop-help/15019.html

Batch: %time% won't update in loop www.computing.net/answers/programming/batch-time-wont-update-in-loop/16711.html