home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
t
/
tsbat.zip
/
TSBAT.EXE
/
C.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-07-30
|
1KB
|
47 lines
echo off
echo Lazy changing of directory
echo By Prof. Timo Salmi, ts@uwasa.fi, Thu 30-Jul-1992
echo.
rem If you are fed up with typing \ in changing the directory
rem with the cd command, this is the batch for you
rem E.g. if you have a directory \text\jokes\stupid the just use
rem c text jokes stupid
rem Applying c without parameters takes you to the root directory
rem Drive can be an optional first parameter, e.g. c d: text jokes stupid
set drive_=
for %%d in (a b c d e f g h i j k l m n o p q r s t u v x y z) do if "%1"=="%%d:" set drive_=%%d:
if "%drive_%"=="" goto _set_dir
if not exist %drive_%\nul goto _err_driv
echo Changing drive to %drive_%
%drive_%
shift
:_set_dir
set dir_=
:_loop
set dir_=%dir_%\%1
shift
if not "%1"=="" goto _loop
if not "%dir_%"=="\" if not exist %dir_%\nul goto _err_dir
echo Changing directory to %dir_%
cd %dir_%
goto _out
:_err_driv
echo Drive %drive_% does not exist
goto _out
:_err_dir
echo Directory %dir_% does not exist
:_out
set drive_=
set dir_=
echo on