home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / doshints.doc < prev    next >
Text File  |  1995-01-18  |  3KB  |  76 lines

  1. Here are a few hints for batch files and DOS that I have aquired over the
  2. years that might be helpful....
  3.  
  4. 1. Erasing all files within a directory isn't fun. Not only do you have to
  5.    type 'erase *.*', which takes time playing with that shift key, but you
  6.    also have to wait for the 'are you sure?' prompt.  Well, there's only
  7.    two other ways I know of, to clear your directory. 1> is to step back a
  8.    path and deltree the directory, then 'MD' it again, or 2> (the easy way)
  9.    Write a small batch file to erase all files and do the prompt thing.
  10.    Did you know, that you don't have to type 'erase *.* ' or 'del *.*'. 
  11.    All you need to type is 'erase.' or del.'. Besure not to put a space
  12.    before the period. O.K. here is my solution to this problem.. I call it
  13.    'KILL.BAT'..  Find a directory somewhere in the path and type:
  14.    'COPY CON KILL.BAT' the cursor will automatically carrige return, and 
  15.    there it will wait for input.. Just type these few lines:
  16.   
  17.    @ECHO OFF
  18.    ECHO Y|ERASE. > NUL
  19.  
  20.    AFTER YOU PRESS RETURN ON THE SECOND LINE, PRESS CONTROL AND Z TOGETHER.
  21.    YOU'LL SEE THE THIRD LINE AS:
  22.  
  23.    ^Z
  24.  
  25.    Press enter and you'll see '1 file copied'. That means you did it right.
  26.    From then on, anytime you want to delete the contenst of a directory, 
  27.    fast and easy, just type 'KILL'.
  28.  
  29. 2. How about reading a directory? Pretty simple, right? just type 'dir' and
  30.    there you have it.. Well, what if some program, or someone attribed some
  31.    files within that directory as hidden files.  They won't show up with
  32.    just 'dir'. ...and, yes, you could type 'dir /a:h' actually you don't
  33.    even need the colon. you could type 'dir /ah' and see the hidden files.
  34.    Well what if there was an easy way to view all files within a directory,
  35.    no matter what attributes they might have. It's easy... just type:
  36.  
  37.    'DIR,' Again besure that there is no space.
  38.  
  39. 3. How about updating the date/time stamp on a file within your directory.
  40.    just type:
  41.  
  42.    'COPY FILENAME.EXT/B+,,/Y'
  43.  
  44.    Unfortunatly, this doesn't seem to work with multiple files, but so you
  45.    don't have to keep typing this large command, you could make a simple 
  46.    batch file to simplify it. Example:
  47.    COPY CON STAMP.BAT
  48.    @ECHO OFF
  49.    COPY %1/B+,,/Y
  50.    ^Z
  51.    
  52.    Don't forget to place .bat files like these in a directory within the
  53.    path...
  54.  
  55. 4. Okay, last one. A simple file locator program that will scan your HD
  56.    for a specific file or files.
  57.    COPY CON LOCATE.BAT
  58.    EHCO.
  59.    ECHO SCANNING HARD DRIVE FOR "%1"
  60.    DIR C:\%1 /S /B /P
  61.    ECHO.
  62.    ECHO SEARCH COMPLETE.
  63.    ECHO.
  64.    ^Z
  65.  
  66.    THE /S COMMAND STEPS UP ALL SUBDIRECTORIES, AND THE /P PAUSES FOR
  67.    MULTIPLE FILE LISTINGS, BUT WHAT I AM IMPRESSED WITH IS THE /B COMMAND.
  68.    IT WILL DISPLAY THE DRIVE PATH AND FILE NAME SO YOU KNOW EXACTLY WHERE
  69.    YOU NEED TO GO TO FIND IT.   i.e. C:\GAMES\DOOM\DOOM.WAD
  70.    
  71.    IF ANY OF THESE TIPS ARE NEW TO YOU, AND ARE HELPFUL, THEN MY TIME I
  72.    SPENT TYPING ALL THIS OUT, WON'T BE FOR NOTHING... IF NOT....
  73.    
  74.                              D A M N !
  75.    
  76.