我有以下问题:因为Visual Studio无法处理链引用,我需要将所有"链引用"-DLL复制到我的程序的bin文件夹.为此,我使用Robocopy.
唯一的问题是,我的命令行,我在Visual Studio后期构建事件中输入错误.
ROBOCOPY "$(TargetDir)" "$(SolutionDir)Map\bin\$(ConfigurationName)\" *.dll /LOG:RCPY.log
Run Code Online (Sandbox Code Playgroud)
这是我的构建活动.我现在得到的是:
Gestartet: Fri Jul 06 15:40:30 2012
Quelle : F:\Sicherung\Visual Studio\Projects\Map\Core\Core.GUI\bin\Release\ F:\Sicherung\Visual\
Ziel : F:\Sicherung\Visual Studio\Projects\Map\Core\Core.GUI\bin\Release\Studio\Projects\Map\Map\bin\Release\
Dateien : *.dll
Optionen: /COPY:DAT /R:1000000 /W:30
Run Code Online (Sandbox Code Playgroud)
为什么,它会在第二个路径/参数中的"Visual Studio"的空白区域拆分它.我用引号尝试了一切,但是没有执行Robocopy(至少日志文件没有被覆盖)或者我得到了这个日志条目...
Visual Studio显示:
命令...退出代码16
这意味着存在致命错误,主要是导致无效路径.
我有几个任务使用Robocopy.exe,在其中一个任务中,我得到一个错误结果,0X3但日志文件没有显示任何错误。这是命令:
ROBOCOPY \\X\L$\FORMATION \\Y\O$\FORMATION /MIR /sec /W:2 /R:5 /log:c:\O_journal.log
Run Code Online (Sandbox Code Playgroud)
我试图在没有任务调度程序的情况下启动它,它运行良好,没有出现蚂蚁错误。
我知道错误0X3是:ERROR_PATH_NOT_FOUND。但是日志文件没有显示任何错误。
如果有人有任何线索或任何方法......
此命令有效:
robocopy \\build7\d$ d: *.* /mir /XD "System Volume Information" /XD "$Recycle.Bin"
Run Code Online (Sandbox Code Playgroud)
但是当我尝试添加/ MT标志时:
robocopy \\build7\d$ d: *.* /mir /XD "System Volume Information" /XD "$Recycle.Bin" /MT
Run Code Online (Sandbox Code Playgroud)
我得到的唯一输出是
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Thu Apr 09 09:11:27 2015
Source : \\build7\d$\
Dest : D:\
Files : *.*
Exc Dirs : System Volume Information
$Recycle.Bin
Options : *.* /S /E /COPY:DAT /PURGE /MIR /MT:8 /R:1000000 /W:30
------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
它给了我输出,然后就坐在那里.
我尝试使用/ LOG标志将输出重定向到一个文件,但它仍然只是在一个文件中以相同的输出坐在那里.
它是在背景中做我看不到的东西,还是我做错了什么?
在使用之前,我如何将destl变量更改为大写.我假设某种字符交换,但是我无法使它工作.代码如下 -
@echo off
echo.
set /P "destf=Enter First Name: "
set /P "destl=Enter Last Name: "
set "findest=Z:\ProjectIT\copy\%destl%, %destf%"
robocopy Z:\ProjectIT\copy\test "%findest%" /e /NFL /NDL /NJH /NJS
robocopy Z:\ProjectIT\copy\Construction "%findest%"\1-BLANK-%destl% /e /NFL /NDL /NJH /NJS"
echo Construction folder has been created for "%destl%"
echo.
pause
Run Code Online (Sandbox Code Playgroud)
我试过调用类似下面的东西,但无法让它工作 -
:Uppercase
set %~1=!%1:a=A!
set %~1=!%1:b=B!
set %~1=!%1:c=C!
set %~1=!%1:d=D!
set %~1=!%1:e=E!
set %~1=!%1:f=F!
set %~1=!%1:g=G!
set %~1=!%1:h=H!
set %~1=!%1:i=I!
set %~1=!%1:j=J!
set %~1=!%1:k=K!
set %~1=!%1:l=L!
set %~1=!%1:m=M!
set %~1=!%1:n=N!
set …Run Code Online (Sandbox Code Playgroud) 我一直在使用Robocopy备份我的计算机文件.我一直在使用以下命令:
robocopy C:\Users\ J:\backup\ *.* /a /XD AppData /XJD /R:0 /s
Run Code Online (Sandbox Code Playgroud)
当我在Windows资源管理器中查看我的J驱动器时,我看到名为J:\ Users \的文件夹,但是当我从命令行使用dir时,我看到一个名为j:\ backup的文件夹.备份和用户文件夹似乎是相同的.我也尝试在cygwin中查看J驱动器的内容并查看备份文件夹,但看不到Users文件夹.到底是怎么回事?robocopy是罪魁祸首吗?
我想在构建过程成功后以给定的文件扩展名递归复制所有文件。
机器人复制
ROBOCOPY %source% %destination% /S *.as?x *.xls? *.mrt
Run Code Online (Sandbox Code Playgroud)
复制
xcopy .\*.as?x %destination% /SY
xcopy .\*.xls? %destination% /SY
xcopy .\*.mrt %destination% /SY
Run Code Online (Sandbox Code Playgroud)
我试图在 Visual Studio 的后期构建部分中插入这两种可能性。RoboCopy 退出并出现错误:错误 1 命令“ROBOCOPY source destination /S *.as?x *.xls? *.mrt”退出,代码为 1。某些文件已复制但复制到错误的文件夹 (_PublishedWebsites)。
xcopy 也会复制到错误的目录 (_PublishedWebsites) 并且也不会复制所有文件。
在命令行中,这两个命令都按预期工作。
我已经更新了我的 robocopy 命令:
ROBOCOPY $(MSBuildProjectDirectory) $(MSBuildProjectDirectory)\..\..\..\EDP\Web\Modules\Invoice\Web /S *.as?x *.xls? *.mrt
Run Code Online (Sandbox Code Playgroud)
现在文件被复制到正确的位置,但 robocopy 的返回码导致 Visual Studio 错误。
这里的帮助下,解决这个:
call ROBOCOPY $(MSBuildProjectDirectory) $(MSBuildProjectDirectory)\..\..\..\EDP\Web\Modules\Invoice\Web /S *.as?x *.xls? *.mrt
if %errorlevel% leq 1 exit 0 else exit %errorlevel%
Run Code Online (Sandbox Code Playgroud)
我们的应用程序运行各种操作并在日志窗口中显示输出。一种操作是使用robocopy在文件夹之间复制文件。
这可以正常工作,直到 robocopy 输出包含 unicode 字符。我知道我需要使用 /unicode 选项,但我似乎得到的只是胡言乱语。
这是我的简化代码示例:
class Program
{
static void Main(string[] args)
{
StreamReader outputReader = null;
StreamReader errorReader = null;
using (Process process = new Process())
{
Encoding encoding = Encoding.Default;
if (encoding != null)
{
process.StartInfo.StandardOutputEncoding = encoding;
process.StartInfo.StandardErrorEncoding = encoding;
}
process.StartInfo.FileName = @"C:\Windows\system32\robocopy.exe";
process.StartInfo.Arguments = @"""D:\temp\????????? ????????? ?????"" ""D:\temp\?????? ????????? ?????"" /unicode";
process.StartInfo.ErrorDialog = false;
process.StartInfo.LoadUserProfile = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true; …Run Code Online (Sandbox Code Playgroud) 我使用 ROBOCOPY 将目录从 C: 复制到 D:(因此磁盘在同一 VM 上,没有网络问题)。我使用了选项
*.* /V /X /TS /FP /S /E /COPYALL /PURGE /MIR /ZB /NP /R:3 /W:3
Run Code Online (Sandbox Code Playgroud)
不久之后,我与相同的选项加 /L 进行了比较:
/V /X /TS /FP /L /S /E /COPYALL /PURGE /MIR /ZB /NP /R:3 /W:3
Run Code Online (Sandbox Code Playgroud)
摘要开头说 12 个目录失败:
Total Copied Skipped Mismatch FAILED Extras
Dirs : (many) 30 0 0 12 0
Files : (more) 958 (more-958) 0 0 0
Run Code Online (Sandbox Code Playgroud)
通过 Google(R) 品牌的网络搜索,我看到“FAILED”上面应该有带有“ERROR”字样的行。但我找不到这样的行。如果我在没有列出文件或目录的情况下进行比较,
*.* /X /NDL /NFL /L /S /E /COPYALL /PURGE /MIR /ZB /NP /R:3 …Run Code Online (Sandbox Code Playgroud) 我们正在使用 robocopy(文件版本 5.1.10.1027)来镜像目录树。robocopy 由 python 脚本调用,而不是手动调用。我们依靠 robocopy 的退出代码来确定操作是否成功。如果成功,我们的脚本会继续做很多其他花哨的事情。否则它会立即中止。
据称,robocopy 的退出代码是一个带有以下标志的位字段(https://ss64.com/nt/robocopy-exit.html):
十六进制十进制含义如果设置
0×00 0 No errors occurred, and no copying was done.
The source and destination directory trees are completely synchronized.
0×01 1 One or more files were copied successfully (that is, new files have arrived).
0×02 2 Some Extra files or directories were detected. No files were copied
Examine the output log for details.
0×04 4 Some Mismatched files or directories were detected.
Examine the output log. Housekeeping …Run Code Online (Sandbox Code Playgroud) 我已经设置了一个 robocopy 脚本并且它运行正常。
但是,在日志文件的摘要中,总时间对我来说没有意义,因为作业运行了大约 109 分钟,但总返回 3:39:06?
有人可以解释为什么这看起来不对。
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : 03 April 2019 20:30:04
Source : G:\Backup\
Dest : \\newserver\Backup\
Files : refresh*
Options : /V /S /E /DCOPY:DA /COPY:DAT /PURGE /MIR /Z /PF /MT:1 /R:5 /W:5
------------------------------------------------------------------------------
New File 21.0 g G:\Backup\refresh.bak
Total Copied Skipped Mismatch FAILED Extras
Dirs : 1 1 0 0 0 0
Files : 1 1 0 0 0 0
Bytes : 21.019 g 21.019 g …Run Code Online (Sandbox Code Playgroud)