Created
June 19, 2023 14:04
-
-
Save earnhardt3rd/4edc02b1c3ac667b5aee86ae520a119e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'getopts.pl'; | |
Getopts('m:d:t'); | |
my $MODE = uc($opt_m) || ""; | |
my $DEBUG = $opt_d || 0; | |
if (defined $opt_t) { my %TEST = &_WIN_DRIVES();} | |
1; | |
sub _WIN_DRIVES { | |
my $cmd1 = "reg query hklm\\system\\mounteddevices"; | |
my $cmdX1 = `$cmd1 2>&1`; | |
my @LIST = split('\n',$cmdX1); | |
my %DRIVES_IN_USE; | |
for (my $i=0;$i<=scalar(@LIST)-1 ;$i++) { | |
if ($LIST[$i] =~ /DosDevices/) { | |
my $drive = $LIST[$i]; | |
$drive =~ s/:.*//g; | |
$drive =~ s/.*\\//g; | |
$DRIVES_IN_USE{$drive}="IN-USE"; | |
} | |
} | |
return %DRIVES_IN_USE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment