Jeanuz Debuzz
Jeanuz Debuzz

Reputation: 21

How to Continue a Command after Error in Batch Files?

So here's the code

cd C:\Users\%USERNAME%
G:
md backup
cd backup
c:
xcopy *.* /e /h g:
pause

While the Xcopy is trying to copy certain files it runs into an error, and stops copying, how do I force it to skip the current file and copy the next one?

Upvotes: 1

Views: 2959

Answers (1)

Dan Cundy
Dan Cundy

Reputation: 2849

Use the below switch to continue copying even if there is an error.

/c

Usage

xcopy *.* /e /h /c g:

All switches can be viewed here.

Microsoft - Xcopy

Upvotes: 3

Related Questions