🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #25925

Re: IBM DOS System Variables

#25925
From: Rodrigo Murillo
Date: Sun, 27 Mar 1988 03:45
41 lines
2095 bytes
In article <17020@gatech.edu> ftg@gatech.edu (Gary Peterson) writes:
>In article <1501@ur-tut.UUCP>, nsto@ur-tut (Natalie Stone) writes:
>> Is there a way to assign a variable from within a batch file to be
>> equal to the current directory name so it can then be used in
>> the batch file.
>
>
>Try something like the following:
>
>set tempvar = %prompt%
>set prompt = $p             (Should set prompt to pathname,
>set pathname = %prompt%      may need a backspace, $b?)
>set prompt = %tempvar%
>
>Or since DOS is full of undocumented features, I'm guessing
>that just
>set pathanme = $p
>might work.

Sorry Gary,  this soulution does not work.  DOS does not do
expansion of $p.  The $p is only meaningful to the PROMPT command.
The result of your solution is that 'prompt' contains the literal
'$p'
 
Also beware of surrounding the equal signs in SET commands with spaces.
The are taken literally and become part of the envar name. So...
 
      set foo=bar  and  set foo = bar
 
create 2 different envars.  And if you write batch files that check
for envar contents, it will barf on one of those.  The convention
is not to include any spaces in the SET arguments.  I've seen many
a batch file crapout because of this,  usually with a puzzled user
on the other end.


-- 
_______________________________________________________________________________
 Rodrigo Murillo, University of Colorado - Boulder  (303) 761-0410 
 murillo@boulder.colorado.edu | ..{hao|nbires}!boulder!murillo
 ( Machines have less problems.  I'd like to be a machine. -- Andy Warhol )
Technical Details
Message-ID: <5101@sigi.Colorado.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!sunybcs!boulder!murillo
References: <1501@ur-tut.UUCP> <17020@gatech.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!sunybcs!boulder!murillo
From: murillo@sigi.Colorado.EDU (Rodrigo Murillo)
Newsgroups: comp.sys.ibm.pc
Subject: Re: IBM DOS System Variables
Keywords: IBM, DOS, Directories, batch files
Message-ID: <5101@sigi.Colorado.EDU>
Date: 27 Mar 88 03:45:59 GMT
References: <1501@ur-tut.UUCP> <17020@gatech.edu>
Reply-To: murillo@boulder.Colorado.EDU (Rodrigo Murillo)
Distribution: na
Organization: University of Colorado, Boulder
Lines: 41