variables - batch scripting: how to get parent dir name without full path? -
variables - batch scripting: how to get parent dir name without full path? -
i'm working on script processes folder , there 1 file in need rename. new name should parent directory name. how in batch file? total path dir known.
it not clear how script supposed become acquainted path in question, next illustration should @ to the lowest degree give thought of how proceed:
for %%d in ("%cd%") set "dirname=%%~nxd" echo %dirname%
this script gets path cd
variable , extracts name dirname
.
variables batch-file directory parent
Comments
Post a Comment