title: Batch command to get a txt name, and then set the first word of that TXT in varible
body: <p>I'm having a problem to read a file in the batch script and then set the first word of that file into a variable, and then I'll use it later.</p>
  
  <p>My code is:</p>
  
  <pre><code>set /p file= | dir /b .\*.txt
  
  for /f "delims=-" %%i in (%file%) do set %db_sid%=%%i 
  pause
  </code></pre>
  
  <p>I need to read the file and set just the first word as a <code>db_sid</code> variable.</p>
  
  <p>This is the current content of the text:</p>
  
  <blockquote>
  <pre><code>prod11i-sarasa
  </code></pre>
  </blockquote>
  
  <p>I want <code>db_sid</code> to be just <code>prod11i</code>.</p>