Get windows temporary directory ( Easy )

Posted on 1998-08-20
Last Modified: 2010-04-04
I want to get windows enveronment such as temporary directory and path. If there is more variables it's okay and I'll be thankfull for telling me.

comment :

I nead Delphi equevelant of pascal command :

Motaz, from Sudan
Question by:Motaz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

Answers2000 earned 0 total points
ID: 1337286
Use the GetTempPath API.

The return value will include the final slash if it's a root directory, and no final slash if it's not.

Therefore to make it consistent for me to handle, in whatever language I'm in, I do the following algorithm

1. GetTempDir
2. Check if last char is \
3. If last char is not \ then add one (assuming I always want a final slash, could do the reverse if I never want one)
LVL 10

Expert Comment

ID: 1337287
here is an example that displays a message box telling you the path to the temp folder
  Buffer : array[0..255]of char;

Hope this helps...

Viktor Ivanov

Author Comment

ID: 1337288
Thanks Viktor

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question