home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!kithrup!stanford.edu!ames!elroy.jpl.nasa.gov!usc!rpi!batcomputer!munnari.oz.au!metro!usage!cad10!steve
- From: steve@keystone.arch.unsw.edu.au (Stephen Peter)
- Subject: Re: A batch programming contest for you
- Message-ID: <1992Aug20.084223.15169@usage.csd.unsw.OZ.AU>
- Sender: news@usage.csd.unsw.OZ.AU
- Nntp-Posting-Host: cad10.arch.unsw.edu.au
- Reply-To: steve@keystone.arch.unsw.edu.au
- Organization: Faculty of Architecture, University of New South Wales
- References: <1992Aug19.045036.5132@uwasa.fi>
- Date: Thu, 20 Aug 1992 08:42:23 GMT
- Lines: 43
-
- In article 5132@uwasa.fi, ts@uwasa.fi (Timo Salmi) writes:
- >@echo off
- >rem That's a very inventive trick, Yossi. I expanded a bit. The snag is
- >rem the the file must exist in order to get the extension. Another
- >rem question is how do you get the extension name into an environment
- >rem variable so that we can utilize it.
- >
- >if not exist %1 goto _out
- >if exist echo.* erase echo.*
- >copy %1 echo.* > nul
- >for %%f in (echo.*) do %%f > ext
- >type ext
- >if exist ext erase ext
- >:_out
- >
- >...................................................................
- >Prof. Timo Salmi
- >Moderating at garbo.uwasa.fi anonymous FTP archives 128.214.87.1
- >Faculty of Accounting & Industrial Management; University of Vaasa
- >Internet: ts@uwasa.fi Bitnet: salmi@finfun ; SF-65101, Finland
-
- Now your changing the problem :-)
-
- ts@uwasa.fi (Timo Salmi) writes:
- >write a batch that returns the extension of the
- >(file) name given to the batch as the parameter (%1).
-
- You said RETURNS :-) You didn't say it had to go into a env.var. :-)
-
- Yossi's for %%f... line could even do without the " > ext " at the end - so
- the extension is echo'd to screeen. Though it would fail if the parameter
- wasn't a file (didn't exist)...
-
-
- cheers :-)
- Stephen.
- ---
- _--_|\ S.Peter@unsw.EDU.AU
- / \ Stephen Peter or steve@keystone.arch.unsw.EDU.AU
- \_.--._/<-------------------------------------------------------------------
- v School of Architecture, University of New South Wales, Australia
- Phone +61 2 6974816 Fax +61 2 6621378 Messages +61 2 6974799
-
-