in reply to Two questions (two birds with one stone)

Well, if I remember right, I think the system's volume info is restricted to administrator access, but I'm not sure. That section of your snippet worked on my computer; however, I'm running as Administrator so I'm not sure.

Next, a few suggestions. In your wanted subroutine, you use an if statement like this:

if (/^VCVARS32.BAT\z/s) { ... }

I'm pretty sure this is not what you want. /s makes . match any character INCLUDING newlines, and there most certainly won't be a newline where the . is. Try rewriting it as so:

if (/^VCVARS32\.BAT$/) { ... }

Next, your drive checking if statement seems a bit shiesty. Instead of checking Volume name ($x[0]), you might want to check Volume Serial Number (in your case, will be $x[2]) instead for more reliable results.

Since you are declaring the wanted subroutine inside the foreach loop, perl will scope the sub to that loop; that means it will be recreated at each pass. That will make it slow, so move it out. Finally, I assume the exit is there only for testing purposes...