Finding USB volumes on Win
Richard Gaskin
ambassador at fourthworld.com
Mon Mar 22 11:06:53 EDT 2010
Richard Miller wrote:
> On 3/22/2010 10:05 AM, Richard Gaskin wrote:
>> In January with the help of Phil, Peter, and others I got some great
>> tips for identifying removable drives on OS X and Linux. But I'm
>> having difficulty figuring out how to do the same in Windows.
>>
>> I can find the registry entries to determine which devices are
>> mounted, but they don't contain the info which will let me know
>> which drive letter they're associated with.
...
> This has been working for me:
>
> repeat with i = number of lines of the volumes down to 1
> put line i of the volumes into x
> put getvolumesn(X) into z
> end repeat
>
> function GetVolumeSN pDiskLetter
> local volumeSerialNumber
> -- Supports both "C", "C:" and "C:\" styles
> put char 1 of pDiskLetter & ":" into pDisk
> set the hideConsoleWindows to true
> put shell("dir " & pDisk) into tDirData
> get matchText(tDirData,"Volume Serial Number is
> (.*)\n",volumeSerialNumber)
> if it is true then
> return volumeSerialNumber
> else
> return empty
> end if
> end GetVolumeSN
Thank you, Richard, but I've been getting the volume IDs from the
registry. The challenge I have this morning is to find which volumes
are removable.
Since I last wrote I discovered that the info at
HKEY\Local_Machine\System\MountedDevices\ seems to have what I need.
--
Richard Gaskin
Fourth World
Rev training and consulting: http://www.fourthworld.com
Webzine for Rev developers: http://www.revjournal.com
revJournal blog: http://revjournal.com/blog.irv
More information about the use-livecode
mailing list