gpt4 book ai didi

powershell - 为什么在网络共享上,robocopy比Copy-Item慢?

转载 作者:行者123 更新时间:2023-12-03 01:02:27 25 4
gpt4 key购买 nike

此命令需要1.6分钟:

Copy-Item -Recurse $buildSource $stageShare

这需要2.1分钟:
robocopy.exe $buildSource $stageShare 

$buildSource = 'C:\MyStuff'
$stageShate = '\\somemachine\someshare\mydir'

我需要开关来使其更快吗?

最佳答案

我认为您所看到的时间损失是花费在将数据输出到控制台上的时间,例如文件进度信息。这需要时间,您应该抑制它,以查看它对您时间的影响。

改编自Microsoft Docs for robocopy:

  • /NFL Specifies that file names are not to be logged.
  • /NDL Specifies that directory names are not to be logged.
  • /NJH Specifies that there is no job header.
  • /NJS Specifies that there is no job summary.
  • /NP Specifies that the progress of the copying operation (the number of files or directories copied so far) will not be displayed.


删除作业摘要并不是提高性能的必要条件,但这是一回事。
robocopy.exe $buildSource $stageShare /nfl /ndl /njh /njs /np

关于powershell - 为什么在网络共享上,robocopy比Copy-Item慢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54111091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com