VOGONS

Common searches


First post, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie

Hi,

For the life of me I can't remember how to add to an existing PATH from the command line.

Given that the existing PATH from the Autoexec.bat is:

PATH=c:\dos;c:\windows;

I thought it was something like:

C:\> PATH = %PATH%;c:\masm

But when issuing SET it looks the same as above and NOT like I would expect:

PATH=c:\dos;c:\windows;c:\masm

Cheers,
Craig

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 1 of 16, by konc

User metadata
Rank l33t
Rank
l33t

You remember correctly, this is exactly how it's done. In which DOS version you are getting this behavior?
I can only think of an extreme scenario: the environmental variables size is at the absolute limit and everything past that gets truncated.

Reply 3 of 16, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie

Initially I thought that it was this line:

SHELL=C:\DOS\COMMAND.COM C:\DOS /P /E:256

But I changed the /E from 256 to 1024 no change.

Version: ms-dos 6.22
VirtualBox: 7

Ok, here are my autoexec and config:

DEVICEHIGH=C:\DOS\HIMEM.SYS /VERBOSE /TESTMEM:OFF
DEVICEHIGH=C:\DOS\EMM386.EXE RAM HIGHSCAN VERBOSE

BUFFERS=20,0
FILES=40
STACKS=0,0
DOS=HIGH,UMB
LASTDRIVE=Q
FCBS=10

DEVICEHIGH=C:\NET\IFSHLP.SYS

SET PATH=C:\NET;C:\DOS;
SET TEMP=C:\TEMP
SET TMP=C:\TEMP
SET LIB=C:\MASM5\LIB
SET INCLUDE=C:\MASM\INCLUDE
SET MASM=/ZI
SET LINK=/CO
SET DIRCMD=/O:GN /P

I did have the programs for MS-NET in the autoexec, but I removed them and no change.

So from the command line:

c:\> path=%path%;c:\c600;

c:\> set

prompt=$P$G
comspec=c:\command.com
tmp=c:\temp
temp=c:\temp
dircmd=/o:gn /p
lib=c:\masm5\lib
include=c:\masm5\include
masm=/ZI
link=/CO
path=%path%;c:\c600 <--------???

c:\>

It is treating a variable (%path%) as a literal.
What binary understands that the % is not a literal?

Even pressing F5 and trying to change the path has the same result.
There is something fundamentally wrong.
I am wondering if the system files are messed up in some way.

EDIT: I just tried it over on:
https://www.pcjs.org/software/pcx86/sys/dos/microsoft/6.22/

It is definitely something I am doing wrong.

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 5 of 16, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie
javispedro1 wrote on 2023-01-21, 22:51:

DOS never did this %..% variable substitution in the interactive command line. It was only available in batch files, and the FOR command.
This is unlike NT's and 4DOS, I believe.

Ah, that makes sense, cheers.
I did think it was my misunderstanding somewhere.

So how can I extend the PATH in DOS without retyping the whole path?

Maybe using echo? Or is there another way to accomplish the same?

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 7 of 16, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie
AlaricD wrote on 2023-01-21, 23:33:

Use *SET*:
SET PATH=%PATH%;C:\MASM

Yea, that doesn't work. That is what I was trying and thought that worked.

c:\>SET
.
.
PATH=c:\dos;c:\windows;

c:\>SET PATH=%PATH%;C:\MASM

c:\>SET
.
.
PATH=%PATH%;C:\MASM

I have tried redirection like:
SET PATH=C:\MASM >> %path%

ECHO C:\MASM >> PATH
" " >> %PATH%

Obviously this works in a batch file:

ap.bat

SET PATH=%PATH%;%1;

Ussage:

c:\> ap.bat c:\masm;

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 8 of 16, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Is there anything preventing you from editing autoexec.bat and rebooting?
Also your examples don't seem that long to type?
Is there anything preventing you from adding whatever you want to whichever batch file you want and running that file whenever you want?

How To Ask Questions The Smart Way
Make your games work offline

Reply 9 of 16, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie
DosFreak wrote on 2023-01-21, 23:50:

Is there anything preventing you from editing autoexec.bat and rebooting?
Also your examples don't seem that long to type?
Is there anything preventing you from adding whatever you want to whichever batch file you want and running that file whenever you want?

They were just examples. It was an issue if the PATH became longer.
I was just looking for a way to make quick changes to the PATH without the reboot and did not want to re-invent the wheel by using the above batch file.

For some reason, I believed that it could be done via the command line.

Must have been mistaken.

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 10 of 16, by Masaw

User metadata
Rank Newbie
Rank
Newbie

create a batch file for changing path:
c:\COPY CON PATH!.BAT
@ECHO OFF
SET PATH=%PATH%;%1
^z

c:\path! c:\GAMES

IT WORKS!

VCheck+ Portable Antivirus for DOS
=========================
https://archive.org/details/VCHECK/

Reply 11 of 16, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie
Masaw wrote on 2023-01-22, 05:27:
create a batch file for changing path: c:\COPY CON PATH!.BAT @ECHO OFF SET PATH=%PATH%;%1 ^z […]
Show full quote

create a batch file for changing path:
c:\COPY CON PATH!.BAT
@ECHO OFF
SET PATH=%PATH%;%1
^z

c:\path! c:\GAMES

IT WORKS!

If you scroll back a bit, you'll see that I created a batch file called ap.bat

I was thinking that maybe something could be done with CON. But I am not sure.

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 13 of 16, by javispedro1

User metadata
Rank Member
Rank
Member
CraigAB69 wrote on 2023-01-21, 23:24:

So how can I extend the PATH in DOS without retyping the whole path?

A batch file. Something like ap.bat as you mention above is actually described in the manual.
(It will change the environment of the main shell. ).

Reply 14 of 16, by CraigAB69

User metadata
Rank Newbie
Rank
Newbie
javispedro1 wrote on 2023-01-22, 09:19:

A batch file. Something like ap.bat as you mention above is actually described in the manual.
(It will change the environment of the main shell. ).

Which manual? Page?

“Wyrd bið ful āræd. Fate is inexorable.”

Reply 15 of 16, by javispedro1

User metadata
Rank Member
Rank
Member
CraigAB69 wrote on 2023-01-22, 09:33:

Which manual? Page?

"help set". Examples section.

The same example survives to this day in MSDN: https://learn.microsoft.com/en-us/windows-ser … /set_1#examples

Reply 16 of 16, by doshea

User metadata
Rank Member
Rank
Member

I forgot that environment variables weren't expanded at the prompt in the olden days!

Here's a more fancy solution from PC Magazine - from https://archive.org/details/DOS_Power_Tools_Paul_Somerson page 978:

EDPATHA Charles Petzold Command ---------------------------- Purpose: Lets you edit the DOS PATH directly. Format: […]
Show full quote

EDPATHA Charles Petzold
Command
----------------------------
Purpose: Lets you edit the DOS PATH directly.
Format: [d:] [path] EDPATHA
Remarks:
When you type EDPATHA the cursor will drop down a line, but nothing
else will happen, At this point you can use the normal DOS editing tools
to edit the path. Pressing F3 will summon the entire existing PATH.
Using Fl or the Right Arrow key will write it to your screen character by
character. Press Enter when done to register your changes.

It goes on to explain how the program works. I didn't read it fully but apparently it sends a PATH=... command to COMMAND.COM itself to process.

The actual program should be in https://archive.org/details/PCMagazineDOSPowerTools1988_1 A search on http://discmaster.textfiles.com for the filename "edpatha" also gives lots of matches.