How can I make robocopy silent in the command line except for progress?

前端 未结 8 1763
说谎
说谎 2020-12-22 23:30

I\'m using robocopy to do backups with a PowerShell script, and it\'s pretty awesome, except that I\'d like it to only show the progress percentage while it copies and not a

相关标签:
8条回答
  • 2020-12-22 23:51

    A workaround, if you want it to be absolutely silent, is to redirect the output to a file (and optionally delete it later).

    Robocopy src dest > output.log
    del output.log
    
    0 讨论(0)
  • 2020-12-22 23:53

    There's no need to redirect to a file and delete it later. Try:

    Robocopy src dest > null 
    
    0 讨论(0)
  • 2020-12-22 23:54

    In PowerShell, I like to use:

    robocopy src dest | Out-Null
    

    It avoids having to remember all the command line switches.

    0 讨论(0)
  • 2020-12-22 23:56

    robocopy also tends to print empty lines even if it does not do anything. I'm filtering empty lines away using command like this:

    robocopy /NDL /NJH /NJS /NP /NS /NC %fromDir% %toDir% %filenames% | findstr /r /v "^$"
    
    0 讨论(0)
  • 2020-12-22 23:57

    If you want no output at all this is the most simple way:

    robocopy src dest > nul

    If you still need some information and only want to strip parts of the output, use the parameters from R.Koene's answer.

    0 讨论(0)
  • 2020-12-23 00:01

    I did it by using the following options:

    /njh /njs /ndl /nc /ns
    

    Note that the file name still displays, but that's fine for me.

    For more information on robocopy, go to http://technet.microsoft.com/en-us/library/cc733145%28WS.10%29.aspx

    0 讨论(0)
提交回复
热议问题