home bbs files messages ]

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,488 of 68,980   
   Youri Ligotmi to All   
   Re: How to find a drive letter ?   
   31 Jan 20 23:36:08   
   
   From: yl@free.fr.invalid   
      
   Le 28/01/2020 à 21:24, ythen1234234@gmail.com a écrit :   
   > 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.   
   >   
      
   I tried this one but the last command (set letter=%%A) doesn't work, I   
   added a "echo %letter%" command at the end of the script and the letter   
   isn't displayed.   
   Any idea ?   
      
   Thanks for your help   
      
   YL   
      
   --- 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