Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,486 of 68,980    |
|    Zaidy036 to ythen1234234@gmail.com    |
|    Re: How to find a drive letter ?    |
|    28 Jan 20 16:50:36    |
   
   From: Zaidy036@isp.invalid   
      
   On 1/28/2020 3:24 PM, ythen1234234@gmail.com wrote:   
   > Hi Youri   
   > Here's an example to find a drive letter given its serial number:   
   >   
   > set serial=78EFF2DC   
   > for /f "tokens=1,2*" %%A in ('powershell.exe -noprofile -command   
   "&get-ciminstance Win32_LogicalDisk| Select-Object DeviceId,Volu   
   eSerialNumber|Format-Table -HideTableHeaders"') do if %%B == %serial% set   
   letter=%%A   
   >   
   > To filter on the volume label instead of volume serial, replace   
   VolumeSerialNumber with VolumeName.   
   >   
   or with only batch:   
   1. place a unique file on the drive: _Check.txt   
   2. add a search for the file with file letters limited to possibilities:   
   FOR %f in (E: F: G: H:) DO (IF EXIST %f/_Check.txt SET _Drive=%f)   
      
   If no file not found _Drive will not exist   
   --   
   Zaidy036   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca