On 2/9/22 12:18, ToddAndMargo via perl6-users wrote:

On 9 Feb 2022, at 12:37, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:

Hi All,

Windows 7,10,11

Do we have a command/function that will show all drive
letter and their labels?

Many thanks,
-T

On 2/9/22 04:05, Elizabeth Mattijsen wrote:
 > What would you use on a command-line to get that information?
 >
 > Then look at https://docs.raku.org/routine/run
 >
 > Liz
 >

Hi Liz,

I was hoping for a system32 call built into Raku.

And ordinarily, I do use

wmic.exe volume get deviceid,label,name

With a workaround to the bug in "run" that
does not like quotes in the run line:

qqx, shell not operating quotes properly
https://github.com/rakudo/rakudo/issues/3518

My workaround:

sub RunCmd( Str $CommandStr, Bool $EchoOff = False )  {
    my Str $BatFile = $PathIAm ~ ".bat";
    my Str $RtnStr;
    my Str $CmdStr = "";

    if $EchoOff  { $CmdStr = Q[@echo off] ~ "\n"; }
    $CmdStr = $CmdStr ~ $CommandStr ~ "\n";
    # print "$CmdStr";

    spurt( $BatFile, $CmdStr );
    $RtnStr = qqx { $BatFile };
    # print "$RtnStr\n";
}

I especially like my workaround as I can just
use Q[some_command] in the $CommandStr and
write directly into it as I would from the
command line directly.

The problem I am facing is that Ice Drive's mounted
drive letter is not showing up in my wmic call.
It does show in Windows Explorer (not IE).  And
the Ice Drive's drive letter does not show anything
useful in the registry, which I can also read
with a module I wrote.

So I was really hoping for a built in system32 call.
I really, really don't care for the the trouble
associated with using the "C" interface to call
system 32 dll's, but I may have to.

-T



Figured wmic out.  Ice Drive is a "logical Volume"

   >wmic logicaldisk get DeviceID,VolumeName
   DeviceID  VolumeName

   C:
   E:
   F:
   G:
   H:
   I:
   J:        Icedrive

Would still nice if we had a system32 call for that.

-T


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to