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

USERID Environmental variable and Win 2000

Status
Not open for further replies.

jfield817

Programmer
Jun 2, 2000
153
US
I have an inherited DOS Clipper 5 app in Win 2000 that explicitly reads the value of an environmental variable called "Userid" with getenv but reads it as blank ...If Username is set instead in the environment the app seems to picking up "Username" instead altho It was not programmed to read "Username"

Under Windows 95 "userid" was read sucessfully ...

What is Windows 2000 doing here ...

Thanks
John
 
Hello,
You must remember that environment vars are set from the W2K control panel (System/Environment), not from some dos-like prompt. They can ofcourse be set in a local command-prompt, but they wil only remain while the command-prompt is alive. If you are setting a var from one dos-box, and trying to read from another there will not be any chance of success. Start your app with a batch-file, and set the vars before your app starts, then you can GetEnv them. Btw, the NetName function can read the current username, but that's not what you need I guess. If you can get your hands on NanForum lib (freeware, search for nanfor on google) there you will find some very handy network-id functions, you might be able to use.

Good luck
TonHu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top