Dismiss Notice

Welcome To CK5!

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

Score a FREE 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

    Oct 8, 2001
    Likes Received:
    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

    Apr 18, 2000
    Likes Received:
    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 Premium Member

    May 8, 2001
    Likes Received:
    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