Reputation: 438
I want to grab the current drive letter of the CD Drive and append :\
to it.
I was thinking something like
$test = (get-location).drive.name
$test2 = ":\"
$test = $test + $test2
Then, $test
will equal p:\
This however doesn't seem very efficient, is there a better alternative?
Upvotes: 2
Views: 150
Reputation: 126722
That's all true if you are already located in the cd drive. Here's an alternative way:
(Get-WmiObject Win32_CDRomDrive).Drive+'\'
Upvotes: 0