🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Another MsDos batch programming challenge

#1481
From: Jimmy Liberato
Date: Sun, 13 Sep 1992 04:17
27 lines
1283 bytes
yogi@cs.ubc.ca (Yossi Gil) writes:

>ts@uwasa.fi (Timo Salmi) writes:
>
>>...
>>Write a batch that returns (sets an environment
>>variable) to give the current directory. 
>
>Following my tradition of suggesting dirty tricks here is my 3
>lines version: 
>
>cd >> %0
>echo echo %%set%% >> %0
>set set=^Z
>
>(The above should be invoked with the .BAT extension. It should 
>be quite easy to remove this restriction)

This is very clever but doesn't its self-modifying behavior cause it 
to fail after one use?  (The location of the end-of-file marker, ^Z, 
is important in your scenario.)  And wouldn't CD be a better environment 
variable name than SET?  In any case, I can't come up with something
that works even once! :-(

--
Jimmy Liberato   liberato@dri.com
                 ...uunet!drivax!liberato
Technical Details
Message-ID: <FRDQB0DG@dri.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!drivax!liberato
References: <1992Aug29.063552.26386@uwasa.fi> <1992Aug29.152816.14977@cs.ubc.ca>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!drivax!liberato
From: liberato@dri.com (Jimmy Liberato)
Subject: Re: Another MsDos batch programming challenge
Message-ID: <FRDQB0DG@dri.com>
Reply-To: liberato@dri.com (Jimmy Liberato)
Organization: Novell/Desktop Systems Group, Monterey Development Center
References: <1992Aug29.063552.26386@uwasa.fi> <1992Aug29.152816.14977@cs.ubc.ca>
Date: Sun, 13 Sep 92 04:17:03 GMT
Lines: 30