Sign in to follow this  
Followers 0
doestergaard

Detect Windows folder on different partition

4 posts in this topic

Hi

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



@WindowsDir ?

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)
Next

Share this post


Link to post
Share on other sites

Thanks! Just what I needed  :thumbsup:

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  
Followers 0