Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Good day people, can anyone enlighten me to what this command does.  (Read 2721 times)

0 Members and 1 Guest are viewing this topic.

trespasser

  • Guest
I have been going through some files on a customers server, the old 'IT' guy was a bit of a whizz but stupid with it and lost his job due to stupidity and pron.   :-[

Going through the old server I inherited I found this batch file, I understand that its designed to copy files from one drive to another and probably write a text file at the end of copying, but I can't quite grasp the way its been written.   ???   I frequently use batch files myself and now prefer these to drag and drop as they seem quicker and I dont have to watch that stupid folder and flying paper crap  >:(..... it may be an illusion but thats my preference.

The file in question is below, and my main boggle is whats with the ">" in the middle?  Is this some sort of "xcopy" shorthand??

"\\SERVER1\120gig (H)\Backup\COPY TO BACKUP SERVER.BAT" > "\\SERVER1\120gig (H)\Backup\backup.txt"

I look forward to you educated and varied replies.

Many Thanks

Deerpark



    Egghead
  • Thanked: 1
    Re: Good day people, can anyone enlighten me to what this command does.
    « Reply #1 on: October 24, 2007, 04:52:05 PM »
    The ">" redirects the output from the batch to a file. So while the batch script would normally output text to the console, with the ">" it instead writes it to "backup.txt".

    With one ">" the text will be written to the beginning of the file, overwriting anything currently in it. If you instead use two ">>" the text will be written to the end of the file, thereby appending the text instead of overwriting.

    Check out this site for more redirection action:
    http://www.ss64.com/ntsyntax/redirection.html


    Any sufficiently advanced technology is indistinguishable from magic.
    Arthur C. Clarke (1917 - 2008)

    trespasser

    • Guest
    Re: Good day people, can anyone enlighten me to what this command does.
    « Reply #2 on: October 26, 2007, 01:00:14 PM »
    Many thanks,  its very useful to know.  Now that I know exactly what it does I may well start incorporating it into a few "batches".

    Many thanks for your help.