title: 'cut' like feature for Windows batch file
body: <p>It's been a while since I've done Windows batch files, and I seem to have forgotten everything.  What I want to do is look for services where the path has spaces but the string isn't quoted.  Boy, this would be easy with bash, but...</p>
  
  <p>So, in a nutshell, I start with <code>sc query | findstr SERVICE_NAME</code> and dump that to a temp file.  Then I read it back in to a variable with <code>for /F "tokens=2" %%f in (temp_file) do set services=!services! %%f</code>  That gets me a variable with a space-delimited list of all services on my host.  Now, in a FOR loop against that variable, I run  <code>sc qc %%s | findstr BINARY_PATH_NAME</code> and dump THAT to a temp file.  It winds up containing something like (quotes are mine to preserve all the spaces): </p>
  
  <pre><code>"       BINARY_PATH_NAME   : C:\Windows\system32\svchost.exe -k LocalSystemNetworkRestricted"
  </code></pre>
  
  <p>I've been reading and Googling and testing and trying everything, trying to wind up cutting that output at the <code>:</code> so I can just wind up with the path itself, and then start figuring out the abomination that must be regular expressions under Windows.  But I just cannot get that string split.</p>