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

Author Topic: help me, I'm stupid. Simple .bat files question  (Read 2807 times)

0 Members and 1 Guest are viewing this topic.

Zarevock

  • Guest
help me, I'm stupid. Simple .bat files question
« on: June 20, 2008, 06:33:46 PM »
Sorry for bothering you people, but I am realy stupid, and it seems I cant get even a VERY simple task done.
What I want to know is how can I put multiple command lines in a .bat file, so it may run all of them at once.
what I wanna do is something like:
go to the secific directory
copy 2 files into one.(I know how to do this in the prompt, but when it gets to the . bat file, DOS seems to run only the first line.)
Thanks,
Zare.

Carbon Dudeoxide

  • Global Moderator

  • Mastermind
  • Thanked: 169
    • Yes
    • Yes
    • Yes
  • Certifications: List
  • Experience: Guru
  • OS: Mac OS
Re: help me, I'm stupid. Simple .bat files question
« Reply #1 on: June 21, 2008, 02:23:34 AM »
What's the code you've got so far?

If you go to Notepad, you can create a batch file with pretty much as many lines as you want.
For example:
Code: [Select]
copy "C:\documents and settings\username\desktop\file1.txt" "C:\file.txt
copy "C:\documents and settings\username\desktop\file2.txt" "C:\file.txt

Then go to File, Save As, copyfiles.bat

ghostdog74



    Specialist

    Thanked: 27
    Re: help me, I'm stupid. Simple .bat files question
    « Reply #2 on: June 21, 2008, 02:47:49 AM »
    Sorry for bothering you people, but I am realy stupid, and it seems I cant get even a VERY simple task done.
    What I want to know is how can I put multiple command lines in a .bat file, so it may run all of them at once.
    what I wanna do is something like:
    go to the secific directory
    copy 2 files into one.(I know how to do this in the prompt, but when it gets to the . bat file, DOS seems to run only the first line.)
    Thanks,
    Zare.
    there's no stupid people, only lazy people

    Dias de verano

    • Guest
    Re: help me, I'm stupid. Simple .bat files question
    « Reply #3 on: June 21, 2008, 04:16:10 AM »
    What I want to know is how can I put multiple command lines in a .bat file, so it may run all of them at once.

    You can't do that. You can put multiple commands in a batch file, so that it will run them one after the other. I expect that is what you meant?

    Quote
    go to the specific directory

    Code: [Select]
    cd /d "d:\path\to\desired\directory"
    I am not sure what you mean by this:

    Quote
    copy 2 files into one

    If you mean join two files together to form a third file, then this would do that:

    Code: [Select]
    copy file1+file2 file3
    Why don't you post the batch file that you wrote, since there may be an error in the first line that stops it ever getting to the second one.


     

    « Last Edit: June 21, 2008, 04:35:05 AM by Dias de verano »

    Schop

    • Guest
    Re: help me, I'm stupid. Simple .bat files question
    « Reply #4 on: June 22, 2008, 05:58:12 AM »
    It may be usefull to insert a "Pause" command after each line so that you can take time to read the console output and determine what's failing.
    A simple spelling mistake can be found by reading the output.