@echo off if (%1)==() ( cd goto Exit ) if (%1)==(/?) goto Usage if not (%2)==() goto Usage for %%p in (%1) do ( %%~dp cd "%%~fp" ) goto Exit :Usage echo usage: %0 [ {rel_path} / {abs_path} ] echo. echo Switches to current drive and the current dir to those echo of the supplied path. echo. echo If no argument is supplied, displays the current dir. :Exit