을 -Loop : 나는 희망MS-윈 - CMD PUSHD/POPD이 작동하는 방식과 나는이 스크립트를 쓴 내가 답을 찾을 다시하고 다시 faild 후 왜에 "/ F를 들어"
<!-- : first Line of "JustPopdBack.cmd"-Script (a CMD+Script for Windows)
@echo off %debug%
setLocal enableExtensions
:: Copyleft 2017 Markus Merkle (aka Mäx) - Licence: GNU-GPLv3
:: ----------------------------------------------------------------------------
:: Cause it seems stupid to make a short Script long just for Right
:: of the Author, so the Licence-Text is not embeded in this Script.
:: !!! Please have a look on <http://www.gnu.org/licenses/>
:: if you still don't know the GNU-GPLv3.
:: ----------------------------------------------------------------------------
:: This is just a free and open TestScript
:: Feel free to used or modify but please mark this work (how as done).
:: -----------------------------------------------------------------------------
title JustPopdBack-Test
color 0a %= cause I like LightGreen on Black =%
echo.
echo. Just a Test-Script for PushD and PopD Command
echo.
echo. To use it please Enter some Directorys first
echo. Don't shy to use diffrent Drives (C:\ or D:\ etc.)
echo. ...and feel free to use the TAB-Key then...
echo. Lets PushD in this Dir and after just Enter Nothing Popd out.
::******************************************************************************
:dLoop for UserQuest and Pushd in
echo.
set "NxtDir="
set /P "NxtDir=NextDir? :\> "
if defined NxtDir (PushD %NxtDir% & goTo dLoop)
::------------------------------------------------------------------------------
echo.
echo. Lets see the PushD History
pushD
echo. now try again with "For /F"-Loop a PopD Back.
for /f %%a in ('pushD') do (echo %%a && PopD)
echo.
echo This don't work - did you know why?
timeOut -1
:*******************************************************************************
:PopDback that will work
PopD && Echo. Uh I PopD'd - let's'ee PushD now: && PushD && goTo PopDback
:: but I don't like that - can you help to make me happy ?
--------------------------------------------------------------------------------
timeout -1
color
exit /b %= That the End of this Script =%
:: Thnx to all my Teachers
:: ...but the realy ones not the called & most have just 60 Minutes for me...
을 당신은 내가 왜이 스크립트를 썼는지 보았습니다. 그리고 여러분 모두가 저에게 많은 코멘트를 주길 바래요. 그래서 우리는 여기서 무엇이 잘못되고 있는지, 어쩌면 거기에 있는지 알 수 있습니다. (내 머리 속에 있지 않습니다 .- 희망 :-)
이 게시물의 내 발부는
for /f %a in ('PushD') do PopD
내가 돈 ' 인수없이'pushd '에서 기대하는 것을 알고 있습니까? 그것은'CD'처럼 작동합니다 - 단순히 현재 디렉토리를 보여줍니다. 프롬프트에'$ +'를 포함하면 cmd 행에서 테스트하는 동안 pushd 스택의 깊이를 볼 수 있습니다. 도움말보기'pushd'와'help prompt' – LotPings
둘 이상의 PushD로 스크립트를 시도해보십시오. 인자없이 "pushd"를 사용하면 푸시 된 디렉토리 목록을 볼 수 있습니다. - cd와의 차이가 조금 있습니다. allways 사용 : echo % cd % - 당신 덕분에 이제는 더 짧은 길을 알았습니다 ... ? 프롬프트는 For 루프를 사용하는 솔루션 일 수 있습니까? –
당신은 jeb의 대답을 받아 들여야 만합니다. for/f에 의해 강제 된 새로운 cmd 컨텍스트는 이전 cmd의 pushd 스택을 알지 못하며 대상은 해결할 수 없습니다. – LotPings