I want to split the string (having a path) with \\and take last folder name in a variable. Please help.
\\
e.g mypath=D:\\FOLDER1\\FOLDER2\\FOLDER3\\>
When your current folder contains spaces then try this:
@echo off for %%f in ("%CD%") do set LastPartOfFolder=%%~nxf echo %LastPartOfFolder%