|
-
Sep 15th, 2001, 03:49 PM
#1
Thread Starter
Member
Get the Windows directory?
How can I get the Windows directory path in QBasic? Or for that matter, how can I get the contents of any environment variable in QBasic (like %PATH%, %CLASSPATH%, %TEMPDIR%, etc.)?
-
Sep 15th, 2001, 05:15 PM
#2
Fanatic Member
You can get from QB using Environ$(), just like in VB .
Code:
DIM i AS INTEGER
DIM strEnv AS STRING
i = 1
strEnv = ENVIRON$(i)
DO UNTIL strEnv = ""
PRINT i; CHR$(34); strEnv; CHR$(34)
i = i + 1
strEnv = ENVIRON$(i)
LOOP
PRINT
END
The only thing that seems to be a little funky is that it's case sensitive if you request an environment variable by name, such as Environ$("windir") to get the windows directory. In my system, the environment var is %windir%, but if you ask for it with Environ$("WINDIR"), you get nothing back. Since you may or may not know the actual capitalization of the var itself, it's probably better to go off of index number and make up your own array or something.
Last edited by Kaverin; Sep 15th, 2001 at 05:20 PM.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Sep 15th, 2001, 05:55 PM
#3
Thread Starter
Member
Cool.
-
Sep 16th, 2001, 02:09 PM
#4
Thread Starter
Member
What I'm trying to do is make my own installer stub that copies the VB runtimes and then executes a VB setup EXE. So can I always ensure that the path is %WINDIR%? This is my SET stuff:
Code:
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Arien Talabac\Application Data
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=TOWER1
ComSpec=C:\WINNT\system32\cmd.exe
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Arien Talabac
LOGONSERVER=\\TOWER1
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Path=C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\WBEM;D:\programs\borland\tcpp452\BIN
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0806
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINNT
TEMP=C:\DOCUME~1\ARIENT~1\LOCALS~1\Temp
TMP=C:\DOCUME~1\ARIENT~1\LOCALS~1\Temp
USERDOMAIN=TOWER1
USERNAME=Arien Talabac
USERPROFILE=C:\Documents and Settings\Arien Talabac
windir=C:\WINNT
-
Sep 16th, 2001, 03:03 PM
#5
Fanatic Member
As long as windows in some form is on, I believe you can always assume %windir% will be that dir.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Sep 16th, 2001, 03:34 PM
#6
Thread Starter
Member
So will a VB program run if the MSVBVM50.DLL is in the Windows directory, or the system directory? I don't see any listing for a system directory.
-
Sep 16th, 2001, 05:07 PM
#7
Fanatic Member
As long as the dll is registered, I'd guess that it would work. And if you can get the windows dir, the system one would just be windir\system.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Sep 16th, 2001, 05:41 PM
#8
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|