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.)?
Printable View
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.)?
You can get from QB using Environ$(), just like in VB :).
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.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
END
Cool. :cool:
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
As long as windows in some form is on, I believe you can always assume %windir% will be that dir.
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. :(
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.
c:\winnt\system32