Computer Hope

Microsoft => Microsoft DOS => Topic started by: migasmike on April 10, 2006, 03:56:08 AM

Title: xcopy and print log file help?
Post by: migasmike on April 10, 2006, 03:56:08 AM
Hi,

I have this batch files created xcopy d:\backupl g:\backup /e /c /i /f /h /d /y in Windows XP.
The drive letter d: is the partition d: and the drive letter g: is a Firewire external HDD.

I donīt know hi, but in the last week the batch files doesnīt run until he is finishid, but i canīt see the error message because the windows close to quickly and i can see...

I think that is possible to put a command file in this batch to write a Log file to the HDD, and read the log file discoreved the error...?

I donīt know how to do it :-[

Someone can help me please.

Thanks,

MigasMike
Title: Re: xcopy and print log file help?
Post by: Sidewinder on April 10, 2006, 05:08:13 AM
xcopy issues error codes that can be checked by a batch file.

0  Files were copied without error.
1  No files were found to copy.
2  The user pressed CTRL+C to terminate xcopy.
4  Initialization error occurred. There is not enough memory or disk space, or you entered an invalid
    name or invalid syntax on the command line.
5 Disk write error occurred.
 
Something like this may work:

Code: [Select]
xcopy d:\backupl g:\backup /e /c /i /f /h /d /y > file.log
if errorlevel 1 notepad file.log

You may have to use pathnames for the file.log depending where you want to put the log.

Hope this helps. 8-)