Discussion:
Question about pushd/popd
(too old to reply)
Kenny McCormack
2021-11-02 20:11:50 UTC
Permalink
CMD.EXE has a version of the pushd/popd commands, obviously based on the
pre-existing commands in the Unix shells (starting with csh, about 4
decades ago).

However, as far as I can tell, the DOS/Windows implementations of these
commands is missing one key functionality - that is, the ability to see
what is on the stack. That is, to see what you will get if you do "popd".
And, in fact, IMHO, it's not really worth much to have the stack and to be
able to "pop" if you have no idea where you're going to pop to.

Note, BTW, that you might argue that you should know where pop is going to
take you, because you should remember where you were before you did the
last "push". This may or may not be true, but what if you've push'd
multiple times? You can't be expected to remember everything, can you?

So, I hope I'm missing something. Is there any way to tell what
directories are currently in "the stack" ?
--
Most Southerners interest in, knowledge of, and participation in politics begins with
and ends with: Screw the blacks. If a guy is onboard with that, he's our guy!

Get them back in chains where they belong!
MikeS
2021-11-03 08:07:06 UTC
Permalink
Post by Kenny McCormack
CMD.EXE has a version of the pushd/popd commands, obviously based on the
pre-existing commands in the Unix shells (starting with csh, about 4
decades ago).
However, as far as I can tell, the DOS/Windows implementations of these
commands is missing one key functionality - that is, the ability to see
what is on the stack. That is, to see what you will get if you do "popd".
And, in fact, IMHO, it's not really worth much to have the stack and to be
able to "pop" if you have no idea where you're going to pop to.
Note, BTW, that you might argue that you should know where pop is going to
take you, because you should remember where you were before you did the
last "push". This may or may not be true, but what if you've push'd
multiple times? You can't be expected to remember everything, can you?
So, I hope I'm missing something. Is there any way to tell what
directories are currently in "the stack" ?
They are intended to be used in (batch) programs and work the same as
push and pop a register value in languages like MASM. As you said, if
pushd is used several times without popd your program needs to keep
track of the directories pushed and their order. You can only recover a
lower item in the stack by popping off those above first.
Kenny McCormack
2021-11-03 17:36:19 UTC
Permalink
Of course, it is also possible to use these commands in scripts, but I've
always used them mostly interactively.
Do you really use a pure CMD shell interactively? Take a look at
the Windows version of Midnight Commander, it makes live so much easier.
Don't understand this posting from you in this thread.

If I want Windows Explorer, I know where to find it.
--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/Cancer
Herbert Kleebauer
2021-11-03 19:08:48 UTC
Permalink
Post by Kenny McCormack
Do you really use a pure CMD shell interactively? Take a look at
the Windows version of Midnight Commander, it makes live so much easier.
Don't understand this posting from you in this thread.
If I want Windows Explorer, I know where to find it.
That has nothing to do with Windows Explorer or the many Explorer
replacements like Total Commander. These are Windows GUI programs
and if you start a batch or console program, they first have to
create a new cmd window to start the program. Midnight Commander
(or FarManager https://www.farmanager.com/ ) are console programs,
you first open a cmd window and then start MC within the window.
If you then use MC to change the current directory, this has the same
effect as typing the cd command manually. By just pressing <CTRL>-o
MC goes to background and the content of the cmd window is displayed.
I normally use 3 MC windows, one to edit the batch file, one to execute
the batch and one to edit/read in- and output files from the batch.
Kenny McCormack
2021-11-03 19:16:57 UTC
Permalink
In article <slumo1$1vcb$***@gioia.aioe.org>,
Herbert Kleebauer <***@unibwm.de> wrote:
...
Post by Herbert Kleebauer
I normally use 3 MC windows, one to edit the batch file, one to execute
the batch and one to edit/read in- and output files from the batch.
Well, I am happy for you. Well done.
--
People sleep peaceably in their beds at night only because rough
men stand ready to do violence on their behalf.

George Orwell
mokomoji
2021-11-03 19:37:10 UTC
Permalink
You are mistaken.
Why we use cmd programming and scripts

WINDOOWS RESOUCE ONLY USE
3An environment
Anyplace, Anywhere, Anytime
3 no
no install, no setting, no comfile

Is this the reason?

i say "no~!!!"

why? We hate being lazy and annoying.

install annoying
syntex annoying

We have to throw away "cmd" again to learn it.

Do I have to install and learn the program?

no...

The "gui" function is difficult to unattend, which is the "cui" function.

"cui" works if you run it.
After running "gui", the button must be pressed for it to work.

After running "gui" most of them require human hands.

why?
If we don't need a button we can
There is no reason to gui.

That's why we do cui.
Computing Automation
Klaus Meinhard
2021-11-04 10:05:54 UTC
Permalink
Post by Herbert Kleebauer
That has nothing to do with Windows Explorer or the many Explorer
replacements like Total Commander. These are Windows GUI programs
and if you start a batch or console program, they first have to
create a new cmd window to start the program. Midnight Commander
(or FarManager https://www.farmanager.com/ ) are console programs,
you first open a cmd window and then start MC within the window.
If you then use MC to change the current directory, this has the same
effect as typing the cd command manually. By just pressing <CTRL>-o
MC goes to background and the content of the cmd window is displayed.
I normally use 3 MC windows, one to edit the batch file, one to execute
the batch and one to edit/read in- and output files from the batch.
If you really like the batch language and the command line, why use
brain-dead CMD instead of something hreatly enhanced and free? I quote
from the JPSOFT website:

TCC/LE is our free (unsupported) Windows command shell (formerly known
as 4NT). TCC/LE is a replacement for the CMD command line (the default
Windows command prompt). TCC/LE is a superset of CMD, with 111 internal
commands (CMD has fewer than 40), 240 internal variables and functions,
and hundreds of enhancements to existing CMD commands.
TCC/LE works with your existing command line applications and batch
files, but offers major improvements in command line and batch file
capabilities, and adds thousands of new features to your command prompt
windows.

And no, I have nothing to do with that company, but I use their products
from 4DOS v2.0 onwards and heartily recommand them.
--
Mit freundlichen Grüßen,

* Klaus Meinhard *
Zaidy036
2021-11-03 20:52:31 UTC
Permalink
Post by MikeS
Post by Kenny McCormack
CMD.EXE has a version of the pushd/popd commands, obviously based on the
pre-existing commands in the Unix shells (starting with csh, about 4
decades ago).
However, as far as I can tell, the DOS/Windows implementations of these
commands is missing one key functionality - that is, the ability to see
what is on the stack.  That is, to see what you will get if you do
"popd".
And, in fact, IMHO, it's not really worth much to have the stack and to be
able to "pop" if you have no idea where you're going to pop to.
Note, BTW, that you might argue that you should know where pop is going to
take you, because you should remember where you were before you did the
last "push".  This may or may not be true, but what if you've push'd
multiple times?  You can't be expected to remember everything, can you?
So, I hope I'm missing something.  Is there any way to tell what
directories are currently in "the stack" ?
They are intended to be used in (batch) programs and work the same as
push and pop a register value in languages like MASM. As you said, if
pushd is used several times without popd your program needs to keep
track of the directories pushed and their order. You can only recover a
lower item in the stack by popping off those above first.
Since you are doing manually why not make a small batch to add dir into
a txt file before the popd and repeat the batch as needed so the txt
file has a list in order you did the popd's.
Kenny McCormack
2021-11-03 23:44:41 UTC
Permalink
In article <slusqe$4t8$***@dont-email.me>,
Zaidy036 <***@air.isp.spam> wrote:
...
Post by Zaidy036
Since you are doing manually why not make a small batch to add dir into
a txt file before the pushd and repeat the batch as needed so the txt
file has a list in order you did the pushd's. And, of course, you also
have to have code to remove entries from the file when you do popd.
Right. And, in fact, I had already done that - actually, did it as a pair
of DOSKEY macros - before starting this thread. It works fine, but, of
course, it is one more piece of baggage that I have to carry around.

My overall reason for posting this thread was that I was concerned that I
had overlooked an easier way to do it. You know how that is - you
implement something that you really do believe should be built-in, but
seems not to be. Then, after writing your version of it, you wonder if
there is something you overlooked. Maybe something documented, maybe not.

So, I come to the experts in this Usenet newsgroup asking if there is a
built-in way to do it. The answer seems to be "No".
--
I've been watching cat videos on YouTube. More content and closer to
the truth than anything on Fox.
mokomoji
2021-11-03 16:25:44 UTC
Permalink
pudsh & popd app souce

cmd pudsh & popd = Recycle Garbage Instructions


https://blog.naver.com/mokomoji/222119813030

https://blog.naver.com/mokomoji/222468615515

https://blog.naver.com/mokomoji/222468758707

https://blog.naver.com/mokomoji/222479267008

https://blog.naver.com/mokomoji/222480365262


This command is a command to create a powerful network drive.
乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃乃
mokomoji
2021-11-03 16:37:52 UTC
Permalink
add on....
https://blog.naver.com/mokomoji/222470464041


pushd & popd
i thank syntex utla best source

@echo off
setlocal
pushd "%~dp0"

.
.
.

:end
popd
endlocal


mokomoji
2021-11-03 17:08:30 UTC
Permalink
very very long ago
I thought about using that command.
Not days, but years, about five years or more.
While applying the Tower of Hanoi algorithm using the stack,
I found that it does not work in 'for cmd'.

Then I knew.
that it is garbage


Some samples for using the command and 5 sources using the command
created it.

But the value of that source is garbage.

for the garbage source

I hope my sources will be recycled through you.
Loading...