I need help with creating batch files.

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

Oct 29, 2011
  1. Ikki
    OP

    Member Ikki GBATemp's grumpy panda.

    Joined:
    Jun 1, 2010
    Messages:
    2,797
    Location:
    Montevideo
    Country:
    Uruguay
    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

    Reporter Foxi4 On the hunt...

    pip
    Joined:
    Sep 13, 2009
    Messages:
    22,736
    Location:
    Gaming Grotto
    Country:
    Poland
    Creating a text file:

    type NUL > textfile.txt

    Writting:

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

    Member Ikki GBATemp's grumpy panda.

    Joined:
    Jun 1, 2010
    Messages:
    2,797
    Location:
    Montevideo
    Country:
    Uruguay
    That did the trick, thanks.

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

    Reporter Foxi4 On the hunt...

    pip
    Joined:
    Sep 13, 2009
    Messages:
    22,736
    Location:
    Gaming Grotto
    Country:
    Poland
    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

    Member Ikki GBATemp's grumpy panda.

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

Share This Page