OS System Variables

Hi, Is it possible in a codeunit to access to system variables of the operating system? I have to save a file in the disk, but, we could have diferent os languages for the clients, so, if i want to save it in a temporary folder independent of os language I can use %TEMP%, you can try if you go to start - run and tyoe %TEMP% the temporary folder will open. Any ideas about it? Thanks in advanced, Nuno Silva

From the ADG: ENVIRON Use this function to return a string associated with an environment variable. String := ENVIRON(Name) String Data type: text constant or code The string associated with the environment variable. Name Data type: text constant or code The name of the environment variable. Comments If the environment variable does not exist, the string that is returned may contain garbage.

Olá! [;)] Yes, you can do that. You have to use the ENVIRON command. To get the contents of the %TEMP% environment variable, for example, you would write: MESSAGE(ENVIRON(TEMP)); [edit] Not only was I beaten to the clock, if you follow my example the message will break on every \ character, which doesn’t look very nice… Boa sorte, anyway! [:D]

Thanks guys. Nuno PS. England prepare to go home

Hi there, is there a list of the variables I can GET using ENVIRON?

quote:


Originally posted by jimiti
From the ADG: ENVIRON Use this function to return a string associated with an environment variable. String := ENVIRON(Name) String Data type: text constant or code The string associated with the environment variable. Name Data type: text constant or code The name of the environment variable. Comments If the environment variable does not exist, the string that is returned may contain garbage.


Open a Command Prompt and type SET. This will give you a list of all available environment variables. Beware! Some of these variables are computer-dependent and even user-dependent. However, most of them are automatically created by Windows. I’m no longer sure if different Windows versions use different environment variables - I’ve been on XP for far too long to remember…