Results 1 to 9 of 9

Thread: MS-DOS, An Ever-Expanding Guide, Version 0.1

  1. #1

    Post MS-DOS, An Ever-Expanding Guide, Version 0.1

    This is meant to be a BASIC guide to MS-DOS commands, have a look at the file MSDEEG.txt (assuming I've posted it correctly) and tell me what you think. For example have I made any errors, missed anything really obvious out e.t.c.

    Cheers,

    T6286

  2. #2
    Senior Member
    Join Date
    Nov 2001
    Posts
    472

    Thumbs up

    This is very good! Learned a few things i didn't know.
    But i didn't understand the part about 'replaceable parameters'.....
    ---
    proactive

  3. #3

    Post

    Originally posted by proactive
    But i didn't understand the part about 'replaceable parameters'.....
    Ok heres a quote from the original file:

    Originally posted by proactive
    Why would you want to use this? Well imagine you have written a batch file which
    deletes three files of the users choice, the file may look something like this:


    @echo off
    rem Delete file one.
    del %1
    rem Delete file two.
    del %2
    rem Delete file three.
    del %3

    To actually execute the file you would type (lets name the file [test]):

    test [file1] [file2] [file2]

    So the %1, %2, %3 represent the first three file names that the user typed in.
    Its explained in the file (perhaps it wasn't clear enough), but I'll try again with a quick tutorial:

    Copy the code from this page, open notepad paste the text and save it as test.bat (be sure its saves as a batch file) run it what happens? You will get a syntax error, which is because you didn't input the parameters. So first make three files on your desktop (call them 1.txt, 2.txt, 3.txt), the batch command will delete the three files which you assign to it. So now try this in MS-DOS: go
    to c:\windows\desktop make sure all of your files are there (including the batch command) then type.

    test 1.txt 2.txt 3.txt

    What happened? All of the files were deleted because when you ran the program it took 1.txt and assigned it to %1, 2.txt and assigned it to %2, and 3.txt and assigned it to %3. so look at the code and this is what it would look like after it takes the parameters off the user.

    @echo off
    rem Delete file one.
    del 1.txt
    rem Delete file two.
    del 2.txt
    rem Delete file three.
    del 3.txt


    Get it? If not mail me and I'll try and help you some more. Note: If there is anything ypu think I've missed out then mail me (address is in the file).

    Regards,

    T6286

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    472
    Now I get it! Thanks!
    ---
    proactive

  5. #5

    Forgot to mention my sources.

    The part about wildcards was taken directly from my lecture notes. The rest was what I've learnt from those notes plus some general knowledge about MS-DOS.

    Sorry about not posting this earlier.

    Regards,

    T6286

  6. #6
    It may also be worth mentioning the use of %0 for recursive batch files. For instance a batch file containing

    mapisend -u "user profile" -p "password" -r "recipient" -c "CClist" -s "subject line" -m "Message Content" -f "attachment path and filename"
    sleep 15
    %0

    I know the "sleep" command is specific to NT but there are equivilents and that mapisend is part of the exchange resource kit but the the file will send send the chosen mail message to the user every 15 seconds. this is useful for test scripts or routines that need to be scheduled with high frequency on a regular basis or annoying your friends )

  7. #7

    Thanks...

    I didn't know that.

    Regards,

    T6286

  8. #8
    Note if you want more MS-DOS then look at these:

    Dos Basics
    Dos Advanced
    Dos Batch Files

    or go to:

    Negative's Tutorial Index

    where I found them.

    Regards,

    T6286

  9. #9
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785
    More on redirection:

    Redirect to a network printer (sometimes) copy somefile.txt PRN

    If you redirect the output of a program to a batch and then run that batch file it will execute another batch file that has the name as the first word returned.

    Ping xxx.xxx.xxx.xxx > result.bat
    Call result.bat

    Will call an existing batch file called reply.bat if the address echoed in reply . if it did not it would run unknown.bat

    you can pipe the output of a program to a second program and rediirect the results to file.

    dir c:\winnt\inetpub\ftproot\*.zip | find /I /c "special.zip" >here.bat and loop it to tell you when a file arrives. (it will call 1.bat

    Not related to redirection but I couldn’t/wouldn’t get along without it. You can have doskey load, everytime you open a dos box in windows 9x and above by going to command.com right clicking on it. In properties under program add “doskey” in the space provided for “batch file”.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •