title: How to check if a drive is mapped to a particular network shared drive
body: <p>Consider I want to map a drive with a shared network drive through a script (batch), I need to map
  eg: <code>T:</code> to <code>\\192.168.1.2\network</code> but when it is already mapped eg: <code>T: -&gt;</code> <code>\\192.168.1.2\network</code> I don't want to map it again, </p>
  
  <p>I have tried the below snippet were it only maps for the first time, when there is a change in the shared drive it does not do the remapping, can anyone tell what went wrong in the code snippet and how to resolve.</p>
  
  <p>The problem is when I change from <code>\\192.168.1.2\network</code> to <code>\\192.168.1.6\network</code> it only check if <code>T:\Jboss</code> is mapped and it does not do the disconnect and remap with <code>\\192.168.1.6\network</code> , one more thing is both <code>\\192.168.1.2\network</code> as well as <code>\\192.168.1.6\network</code> has same direcotry <code>Jboss</code></p>
  
  <pre><code>if exist T:\Jboss (
  echo  already T:\Jboss exists
  )
  if not exist T:\Jboss (
  echo  disconnect T:
  net use T: /delete
  echo  connected T: to network
  net use T: \\192.168.1.2\network\persistent:no
  )
  </code></pre>