Batch Store WMIC Query with multiple conditions into variable
<p>I am using this line in a batch script which successfully stores a user's SID value into a variable called SID</p>

<pre><code>FOR /F "tokens=1,2 delims==" %%s IN ('wmic path win32_useraccount where name^='%_curruser%' get sid /value ^| find /i "SID"') DO SET SID=%%t
</code></pre>

<p>I'd like to modify this to include an "AND" in the WMIC Query but I can't seem to get it to work.</p>

<p>The correct query is:</p>

<pre><code>wmic path win32_useraccount where "name='%USERNAME%' and Domain like 'HB%'" GET SID /VALUE
</code></pre>

<p>Can someone please help me translate this so the SID value is stored into a variable?</p>