Return Code Always 0

October 20, 2010 at 13:16:12
Specs: Windows 2003 - SP2
I am copying a file over from a Win2k3 server via script to several workstations. I am open to any proprietary copy method (copy, xcopy, robocopy, etc). The problem I have is that the return code is always 0. My script is much larger than below but I am still not getting a return code of other an 0 using the few lines even. I have forced some files to read-only on the destination path so access is denied bu still always showing 0. In the below the variable of %1 is not the issue as that value is being correctly assigned.

if exist \\%1\Shared\Colors.txt (
copy C:\file1.bat \\%1\Shared\


See More: Return Code Always 0

Report •

October 20, 2010 at 13:38:54
Try starting with:

setLocal EnableDELAYedeXpansion

and use !errorlevel!

Life is too important to be taken seriously.


Report •

October 20, 2010 at 13:44:14
Yeah I already had that enabled (sorry just chopped it off). Found the problem though, I forgot that I need to use !ERRORLEVEL! and not %ERRORLEVEL% in this instance so with that change its working correctly now.

Report •

Related Solutions

Ask Question