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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetEnv("windir') change behavior 1

Status
Not open for further replies.

mkendi

Programmer
Oct 21, 2000
82
TR
Until yesterday GetEnv("Windir") returns "C:\WinNt"
But now "%SystemRoot%"
What is the reason for this behavior?

Thanks in advance
Mehmet
 
Sounds like maybe you or someone else has been twiddling with your login script or NT environment. "%SystemRoot%" is another environment setting which should in this case be C:\WINNT.
Check you login script to see if the environment string WINNT=%SystemRoot% is in there, or talk to the net admin and see if they have changed anything trying to take a shortcut.

Dave S.
 
Here are a couple alternatives:
* 1) Environment Var
?GetEnv("Windir")

* 2) Win API
Declare Integer GetWindowsDirectory In Win32API ;
String @, Integer
lcData = Space(100)
lnData = 100
lnR = GetWindowsDirectory(@lcData, lnData)
lcWinPath = Substr(lcData,1,lnR)
? lcWinPath

* 3) WSH
#DEFINE WindowsFolder 0
oFS=CREATEOBJECT('Scripting.FileSystemObject')
? oFS.GetSpecialFolder(WindowsFolder).Path
oFS = .null.

Rick
 
Where is my "login script" ? (I am using W2K)
The NT environment I found under "Enviroment Variables"
Start -> Programs -> Accessories -> Systemtools -> SystemInformation and indeed there are Windir set to %SystenRoot% - but this values are all "ReadOnly"


Thanks in advance

PS: rgbean, thanks four this backdoor-solutions.

 
If you are being validated on a Novell server, you would have a login script unless you opted to not run it. That might be an issue.

You need admin rights to access those settings, but look here:

Start->Setting->Control Panel->System
Select the 'Advanced' tab and browse the settings.
It may or may not say %SystemRoot% but %SystemRoot% should be interpreted as 'C:\winnt' by the system anyway.
I guess I don't know why GETENV() would all of a sudden return a different value. However, I do know that using GETENV("WinDir") in Fox 2.x on an NT machine would return a different value ("") when called in a compiled .exe that it would in the developement environment ("C:\WINNT").

Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top