I need help with creating batch files.

Discussion in 'Computer Games and General Discussion' started by Ikki, Oct 29, 2011.

  1. Ikki
    OP

    Ikki GBATemp's grumpy panda.

    Member
    2,797
    49
    Jun 1, 2010
    Uruguay
    Montevideo
    Hai thar

    I need some help with creating some batch files for a homework and I'd be glad if someone who knows more about it than I do could help me out.

    Right now, I need one that creates a text file with text in it inside a folder. How can I set a text to be written in the txt file?

    Thanks in advance. This probably won't be my last question, but I'll try to come ask only if I've no idea of what to do.
     
  2. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,449
    21,341
    Sep 13, 2009
    Poland
    Gaming Grotto
    Creating a text file:

    type NUL > textfile.txt

    Writting:

    echo Your text here >> textfile.txt
     
  3. Ikki
    OP

    Ikki GBATemp's grumpy panda.

    Member
    2,797
    49
    Jun 1, 2010
    Uruguay
    Montevideo
    That did the trick, thanks.

    Now how can I copy everything inside a folder to another folder?
     
  4. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,449
    21,341
    Sep 13, 2009
    Poland
    Gaming Grotto
    XCOPY C:\*.* E:\ /C /S /D /Y /I

    C:\*.* - Source
    E:\ - Destination
    /C - Ignore errors
    /S - Copy everything including subdirectories
    /D - Copies only when source file is newer then a conflicting one
    /Y - Overwrite without premission
    /I - Create new directrories automatically

    EDIT: Silly emoticon lol
    EDIT2: Remember, XCOPY is used to copy entire directories rather than just single files. Keep that in mind when specifying the destination.
     
  5. Ikki
    OP

    Ikki GBATemp's grumpy panda.

    Member
    2,797
    49
    Jun 1, 2010
    Uruguay
    Montevideo
    Awesome.
    That's gonna be it for this homework, I could do the rest of it by myself. Thanks a lot, Foxi ^_^