Jump to content
Sign in to follow this  

Detect Windows folder on different partition

Recommended Posts



I'm writing a script which will return the driveletter where Windows is installed. It is going to be used for reinstallation, so that it will write a diskpart script which formats the partition so no other partition is touched.

The question is how and I hope that someone with a bit more skills than me can help me out. I know that you are able to retrieve disk drives and partitions via WMI, and I think that the solution lies somewhere in there.

Hope you can help me out.

Thanks in advance!

Share this post

Link to post
Share on other sites

DriveGetDrive should suffice, no ?

Local $aDrives = DriveGetDrive("FIXED")
For $i = 1 To $aDrives[0]
    If FileExists($aDrives[$i] & "\Windows\explorer.exe") Then ConsoleWrite("Windows folder found in " & $aDrives[$i] & @CRLF)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.