Category : Utilities for DOS and Windows Machines
Archive   : ENV18A.ZIP
Filename : DIRJUMP.BAT

Output of file : DIRJUMP.BAT contained in archive : ENV18A.ZIP

@echo off
if .%1==. goto POP
if %1==/? goto HELP
goto PUSH

echo Usage: DIRJUMP {Subdir} Save current and go to given directory
echo DIRJUMP Return to previous directory
goto EXIT

env set envtmp1=%1
env set disknow={get*disk},%disknow%
env set dirnow={get*dir},%dirnow%
env set envtmp2=pos(:~%envtmp1%)
env calc envtmp2
if %envtmp2%==0 goto setdir
env set envtmp2=mid(%envtmp1%~1~2)
env calc envtmp2
env set envtmp2=pos(\~mid(%envtmp1%~length(%envtmp1%)~1))
env calc envtmp2
env set envtmp3=mid(%envtmp1%~1~length(%envtmp1%)-%envtmp2%)
env calc envtmp3
cd %envtmp3%
goto EXIT

if .%disknow%==. goto EXIT
if .%dirnow%==. goto EXIT
env set envtmp2=pos(,~%disknow%)
env calc envtmp2
env set envtmp1=mid(%disknow%~1~%envtmp2%)
env calc envtmp1
env set disknow=delete(%disknow%~1~%envtmp2%)
env calc disknow
if %disknow%==0 env erase disknow
env set envtmp2=pos(,~%dirnow%)
env calc envtmp2
env set envtmp1=mid(%dirnow%~1~%envtmp2%)
env calc envtmp1
cd %envtmp1%
env set dirnow=delete(%dirnow%~1~%envtmp2%)
env calc dirnow
if %dirnow%==0 env erase dirnow
env erase envtmp?