How to get process ID of a specific process using wmic and check on error?
<p>I created a batch script which runs WMIC to get the PID from a specific process. If I open the bat script I see 'ProcessID 1234' or 'No Instance(s) Available.' in the command window.</p>

<p>I want to create an IF statement where I check if the output from this command was an PID or <code>No Instance(s) Available.</code>. Which variable can I use for this?</p>

<p><strong>My code:</strong></p>

<pre><code>wmic process where "Name like '%%cmd.exe%%' and CommandLine like '%%WatchdogStarter.bat%%'" get processid
if %%outputfromthiswmiccommand%% == 'No Instance(s) Available.' ....
</code></pre>