title: How to set multiple Delims
body: <p>I am working on writing a script that will create folders based on parts of file names.  The problem is the Delim's are both the same.  File names look like this: "Bacon-HunterBacon-00002"  I am looking at using the first and second tokens to be the folder name.  So the folder would be named Bacon-HunterBacon</p>
  
  <pre><code>@echo off
  
  setlocal enabledelayedexpansion
  
  for %%A in (*.cr2 *.jpg) do (
     echo file found  %%A
  
  
     for /f "delims=" %%B in ("%%A") do set fname=%%~nB
  
  
     for /f "delims=" %%C in ("%%A") do set fextn=%%~xC
  
  
     for /f "tokens=1,2* delims=-" %%D in ("!fname!") do set folname=%%D
     echo folder name !folname!
  
     if not exist "!folname!" (
        echo Folder !folname! does not exist, creating
        md "!folname!"
     ) else (
        echo Folder !folname! exists
     )
  
     echo Moving file %%A to folder !folname!
     move "%%A" "!folname!"
     )
  echo Finished
  </code></pre>