View Full Version : [VB6] - Program Files Variable?
10-07-2007, 04:37 PM
Is there a variable I can use in a string for Program Files?
10-07-2007, 11:25 PM
The %programfiles% variable at the DOS level will give you the program files directory. If your dealing with an x64 Windows Operating system you also want to look for an x86 Program Files directory.
Dim i as Integer
Text1.Text = ""
i = 1
While Environ$(i) <> ""
Text1.Text = Text1.Text + Mid(Environ$(i), 1, InStr(1, Environ(i), "=") - 1) + vbNewLine
i = i + 1
Provides the environment variables on a particular system.
To actually assign an environment variable to a variable in your application you would use:
dim strProgramFile as string
strProgramFile = Environ(”ProgramFiles”)
Here is a link that tells another technique to use: http://vbtechniques.com/content.asp?a=co&cID=624
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.