🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: IBM DOS System Variables

#26251
From: Phil Suematsu
Date: Thu, 07 Apr 1988 09:13
49 lines
2080 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%
>...
>ftg@gatech

Nice try.  You had the right idea.

Here are tested batch files that only use shell commands and COMMAND.COM,
which leave the current directory in the CURRENTDIR environment variable:

For PC-DOS 3.30:
--------------------------------
@echo off
set saveprompt=%prompt%
prompt set currentdir=$p
command/c tmpsetcd>tmpsetcd.bat
prompt %saveprompt%
set saveprompt=
call tmpsetcd
del tmpsetcd.bat
 
For PC-DOS 3.00:
-------------------------------
echo off
set saveprompt= %prompt%
prompt set currentdir=$p
command/c tmpsetcd>tmpsetcd.bat
prompt %saveprompt%
set saveprompt=
tmpsetcd

Note that these batch files work only if you are using a COMMAND.COM that
is NOT patched for turning 'ECHO OFF' automatically.  I couldn't figure out 
how to delete the tmpsetcd.bat file after the PC-DOS 3.00 version.
-- 
_____________________________________________________________
Phil Suematsu | uucp:     ...{trwrb,hplabs}!felix!dhw68k!phil
              | InterNet: phil@dhw68k.cts.com
______________|______________________________________________
Technical Details
Message-ID: <6605@dhw68k.cts.com>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!ccicpg!felix!dhw68k!phil
References: <1501@ur-tut.UUCP> <17020@gatech.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!ccicpg!felix!dhw68k!phil
From: phil@dhw68k.cts.com (Phil Suematsu)
Newsgroups: comp.sys.ibm.pc
Subject: Re: IBM DOS System Variables
Message-ID: <6605@dhw68k.cts.com>
Date: 7 Apr 88 09:13:21 GMT
References: <1501@ur-tut.UUCP> <17020@gatech.edu>
Reply-To: phil@dhw68k.cts.com (Phil Suematsu)
Distribution: na
Organization: Wolfskill residence; Anaheim, CA (USA)
Lines: 49
Keywords: IBM, DOS, Directories, batch files
Summary: Yet another hack