Xcopy / f / r / y / c退出代码4(尝试过在其他答案中找到的所有解决方案)

时间:2014-05-02 16:08:47

标签: visual-studio-2010 xcopy

所以我整个上午都在努力寻找解决方案。我已经检查过我的所有文件路径都没有任何空格,我已经在命令中添加了/ c来忽略错误,我已经检查过我的文件夹不是只读模式(它们不是)。哎呀我甚至将C:\ Program Files \ WinZip添加到系统路径环境变量中。我完全没有想法,到目前为止没有任何工作。任何人都可以想到我尝试的任何其他解决方案吗?

以下是完整错误:

xcopy /f /r /y /c "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\Handlers\*.dnn" "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\_latest\"
xcopy /f /r /y /c "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\Modules\*.dnn" "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\_latest\"
xcopy /f /r /y /c "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\Services\*.dnn" "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\_latest\"
xcopy /f /r /y /c "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\bin\Debug\*.dll" "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\_latest\"
xcopy /f /r /y /c "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\bin\Debug\*.pdb" "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\_latest\"
xcopy /f /r /y /c "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\bin\Debug\*.xml" "C:\Users\bissonk\Desktop\HP\USHC_AMERICAS_US_HC_Ic_Portal\Source\V4.2\Provider\HP.USHC.Portal.Provider.Web.UI\_latest\"

“C:\用户\ bissonk \桌面\ HP \ USHC_AMERICAS_US_HC_Ic_Portal \源\ V4.2 \提供商\ HP.USHC.Portal.Provider.Web.UI \ zip.bat”” 退出代码4. HP.USHC.Portal.Provider.Web.UI

这是zip.bat文件:

REM **********************************************************************
REM * HANDLERS
REM **********************************************************************
REM ===========================
REM = Delete Previous File
REM ===========================
del HP.USHC.Portal.Provider.Web.UI.Handlers.zip

REM ===========================
REM = Add Files to Zip File
REM ===========================
wzzip -a HP.USHC.Portal.Provider.Web.UI.Handlers.zip @..\..\Web.UI.Handlers.files.txt
wzzip -vb HP.USHC.Portal.Provider.Web.UI.Handlers.zip

REM ===========================
REM = Copy the Zip File
REM ===========================
 xcopy /d /f /i /r /s /y /c "HP.USHC.Portal.Provider.Web.UI.Handlers.zip"     "..\..\_latest\"

REM **********************************************************************
REM * MODULES
REM **********************************************************************
REM ===========================
REM = Delete Previous File
REM ===========================
del HP.USHC.Portal.Provider.Web.UI.Modules.zip

REM ===========================
REM = Add Files to Zip File
REM ===========================
wzzip -a HP.USHC.Portal.Provider.Web.UI.Modules.zip @..\..\Web.UI.Modules.files.txt
wzzip -vb HP.USHC.Portal.Provider.Web.UI.Modules.zip

REM ===========================
REM = Copy the Zip File
REM ===========================
xcopy /d /f /i /r /s /y /c "HP.USHC.Portal.Provider.Web.UI.Modules.zip" "..\..\_latest\"


REM **********************************************************************
REM * SKIN OBJECTS
REM **********************************************************************


REM **********************************************************************
REM * SERVICES
REM **********************************************************************
REM ===========================
REM = Delete Previous File
REM ===========================
del HP.USHC.Portal.Provider.Web.UI.Services.zip

REM ===========================
REM = Add Files to Zip File
REM ===========================
wzzip -a HP.USHC.Portal.Provider.Web.UI.Services.zip @..\..\Web.UI.Services.files.txt
wzzip -vb HP.USHC.Portal.Provider.Web.UI.Services.zip

REM ===========================
REM = Copy the Zip File
REM ===========================
xcopy /d /f /i /r /s /y /c "HP.USHC.Portal.Provider.Web.UI.Services.zip"   "..\..\_latest\"

这是构建后事件命令行

xcopy /f /r /y /c "$(ProjectDir)Handlers\*.dnn" "$(ProjectDir)_latest\"
xcopy /f /r /y /c "$(ProjectDir)Modules\*.dnn" "$(ProjectDir)_latest\"
xcopy /f /r /y /c "$(ProjectDir)Services\*.dnn" "$(ProjectDir)_latest\"
xcopy /f /r /y /c "$(ProjectDir)$(OutDir)*.dll" "$(ProjectDir)_latest\"
xcopy /f /r /y /c "$(ProjectDir)$(OutDir)*.pdb" "$(ProjectDir)_latest\"
xcopy /f /r /y /c "$(ProjectDir)$(OutDir)*.xml" "$(ProjectDir)_latest\"
"$(ProjectDir)zip.bat"

1 个答案:

答案 0 :(得分:0)

这可能是由于XCOPY命令中的目录路径无效或XCOPY命令中的目录路径长度超出允许限制。

在我的情况下,目录路径中提到的文件夹名称之一中有空格。删除文件夹名称中的空格时,它可以正常工作。

当您正在构建应用程序(例如:任何Windows应用程序)时,如果它已经打开并且它在XCOPY命令中引用了dll,则会发生此错误。在这种情况下关闭应用程序并再次尝试构建。它会起作用