home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / msdos / programm / 8612 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.4 KB  |  42 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!mcsun!news.funet.fi!uwasa.fi!ts
  3. From: ts@uwasa.fi (Timo Salmi)
  4. Subject: Re: A batch programming contest for you
  5. Message-ID: <1992Aug19.045036.5132@uwasa.fi>
  6. Organization: University of Vaasa, Finland
  7. References: <1992Aug18.052017.3758@uwasa.fi> <1992Aug18.233207.1159@cs.ubc.ca>
  8. Date: Wed, 19 Aug 1992 04:50:36 GMT
  9. Lines: 31
  10.  
  11. In article <1992Aug18.233207.1159@cs.ubc.ca> yogi@cs.ubc.ca (Yossi Gil) writes:
  12. >I am away from my DOS machine now, but I think that the above ideas
  13. >will work after some polishing. 
  14. >
  15. >    erase echo.*
  16. >    copy %1 echo.*
  17. >    for %%f in (echo.*) do %%f > ext 
  18. >
  19. >The extension of %1 should be in the file ext now.
  20. >
  21. >Joseph (Yossi) Gil                 {alberta,uw-beaver,uunet}!ubc-cs!yogi
  22.  
  23. @echo off
  24. rem That's a very inventive trick, Yossi.  I expanded a bit. The snag is
  25. rem the the file must exist in order to get the extension. Another
  26. rem question is how do you get the extension name into an environment
  27. rem variable so that we can utilize it.
  28.  
  29. if not exist %1 goto _out
  30. if exist echo.* erase echo.*
  31. copy %1 echo.* > nul
  32. for %%f in (echo.*) do %%f > ext
  33. type ext
  34. if exist ext erase ext
  35. :_out
  36.  
  37. ..................................................................
  38. Prof. Timo Salmi
  39. Moderating at garbo.uwasa.fi anonymous FTP archives 128.214.87.1
  40. Faculty of Accounting & Industrial Management; University of Vaasa
  41. Internet: ts@uwasa.fi Bitnet: salmi@finfun   ; SF-65101, Finland
  42.