Friday, 12 February 2010

CMD/BAT A few useful routines

Analogues of pwd, basename and dirname.

pwd

:: Print the working directory
call :pwd

:: Populate the the variable var1 with the working directory
call :pwd var1

basename

:: Print a basename of an argument
call :basename "%~1"

:: Populate the variable var1 with a basename
call :basename "%~1" var1

dirname

:: Print a dirname of an argument
call :dirname "%~1"

:: Populate the variable var1 with a dirname
call :dirname "%~1" var1

Sources

No comments:

Post a Comment