Jump to content

Detect Windows folder on different partition


Go to solution Solved by jguinch,

Recommended Posts

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!

Link to comment
Share on other sites

  • Solution

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...