11

I'm trying to robocopy some files silently. Right now, I have robocopy putting everything into a log file, which is fine, but after it finished, Log File: C:\<logfiledestination> is printed. My command looks like this:

robocopy source destination /mir /xd .svn /log:log.txt /np >nul 2>&1.

From searching online, I thought that >nul 2>&1 would have prevented anything from showing up. I'm extremely new to the windows command line, so if I'm doing something wrong, please let me know!

Edit: I had a phantom half-sentence in there that I missed. Fixed now though.

4
  • 1
    Looks good to me. Does robocopy have a quiet switch (/q maybe?). BTW, The interpretation of >nul 2>&1 is "redirect stdout to nul and redirect stderr (file handle 2) to stdout (file handle 1) and therefor to nul.
    – uSlackr
    Sep 19, 2011 at 17:39
  • Thanks. robocopy doesn't look like it has a quiet switch; is it possible that robocopy is printing to console and not stdout?
    – CoV
    Sep 19, 2011 at 18:23
  • Nevermind. That command is working fine. My real problem is actually coming from perl, since I am using the system command to call that command in a perl script. The >nul is not hiding the output from perl, so it's still showing up in my perl output.
    – CoV
    Sep 19, 2011 at 19:14
  • I guess I was searching for the wrong answer. My final solution comes from calling the above command using backticks instead of perl's system. Thanks for your help though!
    – CoV
    Sep 19, 2011 at 19:19

2 Answers 2

16

These switches worked for me:

/NFL : No File List - don't log file names.
/NDL : No Directory List - don't log directory names.
/NJH : No Job Header.
/NJS : No Job Summary.'
2
3

It looks like these two options may be of help to you:

/NJH :: No Job Header.
/NJS :: No Job Summary.
2
  • This deserves more votes than the 4-switch answer. This is only 2 switches, and should be the answer.
    – johny why
    Sep 10, 2021 at 9:39
  • on further experimentation, your 2 switches aren't enough to suppress messages in all cases :(
    – johny why
    Sep 10, 2021 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .