Author Topic: Checking whether a drive is mapped or substituted  (Read 1170 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Checking whether a drive is mapped or substituted
« on: March 21, 2018, 01:55:59 PM »
To check if mapped drive exist then delete/disconnect it:
Code: [Select]
if exist X: (net use /d /y X:)

similarly, for substituted drive:
Code: [Select]
if exist X: (subst /d X:)
however, you can't delete/disc a mapped drive using subst or vise versa, hence there is a need to check whether a drive was mapped or substituted, using:
Code: [Select]
net use | find " V: " >nul && (net use /d /y V:) || (subst /d V:) >nul
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================