CODE: [Copy to clipboard]@echo off set str=\\server\temp$\winxp\run.bat echo str is %str% set str=%str:winxp=_% for /f "tokens=1 delims=_" %%a in ("%str%") do echo.str is %%a