Working in Windows and (preferably) Powershell, I'm looking to return a list of virtual drives supported by ImDisk. When I run:
imdisk -l
I get data such as:
\Device\ImDisk0
However, I'm looking to get what drive letter that is associated with currently. I'm hoping to avoid looping through all 26 possible drive letters with:
imdisk -l -m $PossibleDrive
or the like, but I don't see other options. Can anyone share any ideas? Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I cannot say for PowerShell, but it's doable with batch:
for /f %I in ('imdisk -l -n') do @imdisk -l -u %I
A bit more difficult if you want to keep only the drive letters:
for /f %I in ('imdisk -l -n') do @for /f "tokens=3 usebackq" %X in (`imdisk -l -u %I 2^>NUL ^|find "Drive letter:"`) do @echo %X
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks! While I'm not using your specific script, you did get me over the hump with imdisk -l -n and then imdisk -l u <numbers prior="" from=""> and then split that via PowerShell. Much obliged. </numbers>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Working in Windows and (preferably) Powershell, I'm looking to return a list of virtual drives supported by ImDisk. When I run:
imdisk -l
I get data such as:
\Device\ImDisk0
However, I'm looking to get what drive letter that is associated with currently. I'm hoping to avoid looping through all 26 possible drive letters with:
imdisk -l -m $PossibleDrive
or the like, but I don't see other options. Can anyone share any ideas? Thanks in advance.
I cannot say for PowerShell, but it's doable with batch:
for /f %I in ('imdisk -l -n') do @imdisk -l -u %I
A bit more difficult if you want to keep only the drive letters:
for /f %I in ('imdisk -l -n') do @for /f "tokens=3 usebackq" %X in (`imdisk -l -u %I 2^>NUL ^|find "Drive letter:"`) do @echo %X
Thanks! While I'm not using your specific script, you did get me over the hump with imdisk -l -n and then imdisk -l u <numbers prior="" from=""> and then split that via PowerShell. Much obliged. </numbers>