Article View: comp.os.msdos.programmer
Article #980Re: A batch programming contest for you
From: Timo Salmi
Date: Wed, 19 Aug 1992 04:50
Date: Wed, 19 Aug 1992 04:50
31 lines
1497 bytes
1497 bytes
In article <1992Aug18.233207.1159@cs.ubc.ca> yogi@cs.ubc.ca (Yossi Gil) writes:
>I am away from my DOS machine now, but I think that the above ideas
>will work after some polishing.
>
> erase echo.*
> copy %1 echo.*
> for %%f in (echo.*) do %%f > ext
>
>The extension of %1 should be in the file ext now.
>
>Joseph (Yossi) Gil {alberta,uw-beaver,uunet}!ubc-cs!yogi
@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
Technical Details
Message-ID:
<1992Aug19.045036.5132@uwasa.fi>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!uwasa.fi!tsReferences:
<1992Aug18.052017.3758@uwasa.fi> <1992Aug18.233207.1159@cs.ubc.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!news.funet.fi!uwasa.fi!ts From: ts@uwasa.fi (Timo Salmi) Subject: Re: A batch programming contest for you Message-ID: <1992Aug19.045036.5132@uwasa.fi> Organization: University of Vaasa, Finland References: <1992Aug18.052017.3758@uwasa.fi> <1992Aug18.233207.1159@cs.ubc.ca> Date: Wed, 19 Aug 1992 04:50:36 GMT Lines: 31