pushd

  • Thread starter Thread starter Jean Pierre Daviau
  • Start date Start date
J

Jean Pierre Daviau

Hi,

Does pushd allow multiple pushd and popd?
Like this?
---
pushd
cd \
cd windows
pause
pushd
cd \
popd
pause
popd
goto :EOF

----------

Thanks for your attention.

Jean Pierre Daviau
--
Easyphp1.8 with Apache1.3.24
Server version: Apache/2.0.55
Server built: Oct 9 2005 19:16:56
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
Processor Radeon7000 0x5159 agp
http://www.jeanpierredaviau.com
 
Jean Pierre Daviau said:
Hi,

Does pushd allow multiple pushd and popd?
Like this?
---
pushd
cd \
cd windows
pause
pushd
cd \
popd
pause
popd
goto :EOF

----------

Thanks for your attention.

Jean Pierre Daviau
--
Easyphp1.8 with Apache1.3.24
Server version: Apache/2.0.55
Server built: Oct 9 2005 19:16:56
DEVC++, borland 5.5
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
Processor Radeon7000 0x5159 agp
http://www.jeanpierredaviau.com

I'm almost sure that used to work, but it doesn't now.

Normally, people seem to use the

PUSHD destdir

form.

I'm sure that it USED to be that

PUSHD

was implicitly

PUSHD .

(note the ".")

but not now, it seems - but you'd need a non-"upgraded" OS to check.

But to fix it,

---
pushd \windows
pause
pushd \
PAUSE
popd
pause
popd
goto :EOF
----------

or

---
pushd .
cd \
cd windows
pause
pushd .
cd \
popd
pause
popd
goto :EOF
----------
 
pushd \windows
pause
pushd \
PAUSE
popd
pause
popd
pause
popd
goto :EOF

Yes. With one more popd it returns to the original path.

Thanks
 
Jean Pierre Daviau said:
pushd \windows
pause
pushd \
PAUSE
popd
pause
popd
pause
popd
goto :EOF

Yes. With one more popd it returns to the original path.

Thanks

It should have returned to the original path after the number of POPD
commands was the same as the number of PUSHDs.

Your batch above shows one POPD more than the number of PUSHDs.


----- batch begins -------
[1]@echo off
[2]echo Starting. currently at %cd%
[3]pushd \windows
[4]echo after pushd1 should currently be at \windows. currently at %cd%
[5]pushd \
[6]echo after pushd2 should currently be at \. currently at %cd%
[7]popd
[8]echo after popd1 should currently be at \windows. currently at %cd%
[9]popd
[10]echo after popd2 should currently be at origin. currently at %cd%
[11]popd
[12]echo after popd3 - should not be required! currently at %cd%
[13]goto :eof
------ batch ends --------

Lines start [number] - any lines not starting [number] have been wrapped
and should be rejoined. The [number] that starts the line should be removed
 
Back
Top