Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect Windows Install Directory

Status
Not open for further replies.

KeyserSoze1877

Programmer
Sep 6, 2001
95
US
I have a program where I made an assumption, like Windows is installed on C:\. My new desktop I installed Windows on a non-C: drive.

How can I programatically detect the drive letter of the Windows install directory?

Thanks

---------------
Keyser Soze
"Vote Pedro.
 
Try this:

Dim WinPath As String

WinPath = Environment.GetEnvironmentVariable("WINDIR")

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thanks jebenson, that'll work just fine!

---------------
Keyser Soze
"Vote Pedro.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top