Dismiss Notice

Welcome To CK5!

Registering is free and easy! Hope to see you on the forums soon.

Score a FREE t-shirt and membership sticker when you sign up for a Premium Membership and choose the recurring plan.

? on creating a batch file and other dos stuff

Discussion in 'The Lounge' started by jackyl, Apr 22, 2002.

  1. jackyl

    jackyl Registered Member

    Joined:
    Oct 8, 2001
    Posts:
    52
    Likes Received:
    0
    Location:
    Idaho
    I was wondering if anyone can tell me how to create a batch file in DOS. I need to know how to make simple batch files nothing big at all.
    Also how to find the size of a file, how to use the edit command, create a tree structure to a floppy, and copy all files with a certain extension. I procrastinated this weekend and didn't get to cover the dos stuff.
     
  2. LKJR

    LKJR 1/2 ton status

    Joined:
    Apr 18, 2000
    Posts:
    2,116
    Likes Received:
    0
    Location:
    Lubbock, Tx
    ok I"m a little rusty but to make a batch file just use the edit command. never done it in 95-2000 but if your in a true dos system hopefully you have qbasic or another edit program just save the file as filename.bat and in the file just type the name of the executable you want to run along with any variables. As far as loops and that sort of thing it's been too long basicly it will just execute on file after another till it ends. you may have to type end at the end of it.
    as far as copying certain extentions copy *.exe (then destination) or copy *.bat etc.

    Wish I could help more but it's been a long while and I"m really rusty
     
  3. newyorkin

    newyorkin 1 ton status

    Joined:
    May 8, 2001
    Posts:
    16,555
    Likes Received:
    157
    Location:
    Los Estados Unitos
    What do you want to know? I love batching/scripting. I write at least 20 batches/scripts a week, if not for work, just for the kick of it.

    Like lkjr said * is your wildcard, so *.exe will copy all exe's in your working directory, *.bat all bat's in the working dir, etc.

    You can write a batch in any text editor, even notepad on a windows machine, as long as you make sure to save as .bat (using " " around your filename as you're saving will force it to use the extension you specify; windows systems with "known filetype extensions" hidden will add a .txt to your filename.bat if you don't use quotes when saving).

    If you are on a dos-only machine, "DIR filename.ext" will show you the filename/creationdate/size of the file you specified under filename.ext. There are a bunch of DIR options, too. Like if you wanted to see all files in a directory listed by creation date, use DIR /O:D for /order:date, or by size /O:s for /order:size. You can look at directories only, excluding loose files by DIR /AD, or see filenames spread across the screen with DIR /W, or look for a certain file or type of file from one directory through all subdirectories with DIR filename.ext /S, or use that without filename to see all contents of all subdirectories under the executing one.

    Also, in DOS as of version 5 I think, if you need to know parameters for a command, type the command with /?, and it will usually list all it's options.

    99% of DOS commands are available in Windows 2000/NT, and the command line is super-powerful in windows 2000, with much much much more functionality and available commands.

    Don't underestimate the power of the clunky ancient command line!! My brother calls me a closet linux freak because I'm so into command line operation...
     

Share This Page