🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1238

Re: Another MsDos batch programming challenge

#1238
From: Robert B. Israel
Date: Wed, 02 Sep 1992 23:45
47 lines
2356 bytes
In <92246.142230F13@psuvm.psu.edu> Kevin <F13@psuvm.psu.edu> writes:

>In article <qzhn!6f.resnicks@netcom.com>, resnicks@netcom.com (Steve Resnick)
>says:
>>In article <1992Aug29.152816.14977@cs.ubc.ca> yogi@cs.ubc.ca (Yossi Gil)      :
>>writes
>>>ts@uwasa.fi (Timo Salmi) writes:
>>>
>>>Following my tradition of suggesting dirty tricks here is my 3
>>>lines version:
>>>
>>>cd >> %0
>>>echo echo %%set%% >> %0
>>>set set=^Z
>>>
>>This is the output, when I run FOO.BAT:
>>        cd >> foo.bat
>>        echo echo %set% >> foo.bat
>>        set set=
>>Cheers!
>>Steve

>   Hello all !  I won't pretend to be a master of batch files (I have almost
>no idea what the above two examples are doing) but I do know there is an
>undocumented DOS command TRUENAME that returns the name of the current
>directory.  Is there a way to set an environment variable to what this
>returns ?  (TRUENAME is suppossed to be given a file name as an argument,
>and it returns the full name of the file, by the way).

>Kevin Furrow (f13@psuvm.psu.edu)

TRUENAME does exist in DOS 5, but not in DOS 3.3.  In this case, though,
you want CD (which only returns the name of the current directory), not
TRUENAME (which returns directory+filename).

The whole point of the exercise is to find ways of setting environment
variables to what a command returns.  In UNIX it would be easy, but in
DOS you have to resort to tricks.

BTW, Yossi's solution should work if you run it as "FOO.BAT" rather than as
"FOO".  

-- 
Robert Israel                            israel@math.ubc.ca
Department of Mathematics             or israel@unixg.ubc.ca
University of British Columbia
Vancouver, BC, Canada V6T 1Y4
Technical Details
Message-ID: <israel.715477510@unixg.ubc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!wupost!gumby!destroyer!ubc-cs!unixg.ubc.ca!unixg.ubc.ca!israel
References: <1992Aug29.063552.26386@uwasa.fi> <1992Aug29.152816.14977@cs.ubc.ca> <qzhn!6f.resnicks@netcom.com> <92246.142230F13@psuvm.psu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!wupost!gumby!destroyer!ubc-cs!unixg.ubc.ca!unixg.ubc.ca!israel
From: israel@unixg.ubc.ca (Robert B. Israel)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Another MsDos batch programming challenge
Message-ID: <israel.715477510@unixg.ubc.ca>
Date: 2 Sep 92 23:45:10 GMT
References: <1992Aug29.063552.26386@uwasa.fi>  <1992Aug29.152816.14977@cs.ubc.ca> <qzhn!6f.resnicks@netcom.com> <92246.142230F13@psuvm.psu.edu>
Sender: news@unixg.ubc.ca (Usenet News Maintenance)
Organization: University of British Columbia, Vancouver, B.C., Canada
Lines: 47
Nntp-Posting-Host: unixg.ubc.ca