MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Find Environmental Variables ( AppData,UserProfiles,Temp,Windir) In PowerBuilder using Context information

Published on 02 November 17
0
0
While using Powerbuilder , some times we might need to get the userprofile path for accesssing .ini files . The below piece of code will be very helpfull for that . Also you can get the usernames, user domain , app data path, temp data path,etc., using this method

String ls_keyword, ls_values []

ContextKeyword lcx_key
this.GetContextService ("Keyword", lcx_key)
ls_keyword = "userprofile" //substitute userprofiles with the other //keywords based on your requirement
lcx_key.GetContextKeywords (ls_keyword, ls_values)

MessageBox (ls_keyword, ls_values[1])

Output:
---------------------------
userprofile
---------------------------
C:\Users\gupthajv
---------------------------
OK
---------------------------

Substitute the ls_keyword with the below one's to find the APPDATA path, etc,.

ALLUSERSPROFILE location of the All Users Profile.
APPDATA location where applications store data by default.
COMPUTERNAME name of the computer.
COMSPEC path to the command shell executable.
HOMEDRIVE drive letter is connected to the user's home directory.
HOMEPATH full path of the user's home directory.
OS name of the operating system.
(Windows XP and Windows 2000 list the operating system as Windows_NT.)
Path search path for executable files.
PATHEXT file extensions that the operating system considers to be executable.
PROCESSOR_ARCHITECTURE processor's chip architecture.
PROCESSOR_LEVEL model number of the computer's processor.
PROCESSOR_REVISION revision number of the processor.
ProgramFiles path to the Program Files folder.
SESSIONNAME connection and session names when connected to terminal server session.
SYSTEMDRIVE drive containing the Windows root directory.
SYSTEMROOT location of the Windows root directory.
TEMP and TMP default temporary directories for applications that are available to
users who are currently logged on.
USERDOMAIN name of the domain that contains the user's account.
USERNAME name of the user currently logged on.
USERPROFILE location of the profile for the current user.
WINDIR location of the OS directory.

This blog is listed under Development & Implementations Community

Related Posts:
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
 
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top