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

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!kithrup!stanford.edu!ames!elroy.jpl.nasa.gov!usc!rpi!batcomputer!munnari.oz.au!metro!usage!cad10!steve
  3. From: steve@keystone.arch.unsw.edu.au (Stephen Peter)
  4. Subject: Re: A batch programming contest for you
  5. Message-ID: <1992Aug20.084223.15169@usage.csd.unsw.OZ.AU>
  6. Sender: news@usage.csd.unsw.OZ.AU
  7. Nntp-Posting-Host: cad10.arch.unsw.edu.au
  8. Reply-To: steve@keystone.arch.unsw.edu.au
  9. Organization: Faculty of Architecture, University of New South Wales
  10. References: <1992Aug19.045036.5132@uwasa.fi>
  11. Date: Thu, 20 Aug 1992 08:42:23 GMT
  12. Lines: 43
  13.  
  14. In article 5132@uwasa.fi, ts@uwasa.fi (Timo Salmi) writes:
  15. >@echo off
  16. >rem That's a very inventive trick, Yossi.  I expanded a bit. The snag is
  17. >rem the the file must exist in order to get the extension. Another
  18. >rem question is how do you get the extension name into an environment
  19. >rem variable so that we can utilize it.
  20. >
  21. >if not exist %1 goto _out
  22. >if exist echo.* erase echo.*
  23. >copy %1 echo.* > nul
  24. >for %%f in (echo.*) do %%f > ext
  25. >type ext
  26. >if exist ext erase ext
  27. >:_out
  28. >
  29. >...................................................................
  30. >Prof. Timo Salmi
  31. >Moderating at garbo.uwasa.fi anonymous FTP archives 128.214.87.1
  32. >Faculty of Accounting & Industrial Management; University of Vaasa
  33. >Internet: ts@uwasa.fi Bitnet: salmi@finfun   ; SF-65101, Finland
  34.  
  35. Now your changing the problem :-)
  36.  
  37. ts@uwasa.fi (Timo Salmi) writes:
  38. >write a batch that returns the extension of the
  39. >(file) name given to the batch as the parameter (%1).
  40.  
  41. You said RETURNS :-) You didn't say it had to go into a env.var. :-)
  42.  
  43. Yossi's  for %%f... line could even do without the  " > ext " at the end - so
  44. the extension is echo'd to screeen.  Though it would fail if the parameter
  45. wasn't a file (didn't exist)...
  46.  
  47.  
  48. cheers :-)
  49. Stephen.
  50. ---
  51.  _--_|\                                                  S.Peter@unsw.EDU.AU
  52. /      \    Stephen Peter                or  steve@keystone.arch.unsw.EDU.AU
  53. \_.--._/<-------------------------------------------------------------------
  54.       v     School of Architecture, University of New South Wales, Australia
  55.             Phone +61 2 6974816   Fax +61 2 6621378   Messages +61 2 6974799
  56.  
  57.