I'm trying to code an InstallScript custiom action that will do a number of things inside the Users TEMP folder.
IE: I need to create a folder, then copy files into it, then copy files from of it into another folder and then finally delete it.
The destination (where I want to create the folder) is as follows.
C:\Documents and Settings\rkode\Local Settings\Temp
The problem is that the value "rkode" is different for each user.
Depending on who is logged on at the time.
Windows has an environmental variable name %USERPROFILE% that point directly to the above TEMP folder based on who is logged on at the time.
So far, I am unable to figure out how to use %USERPROFILE% in the CreateDir command.
Maybe I can't.
The follwoing works, but of course I need to modify it some based on what "user" may be logged on.
szDirPath = "C:\\Documents and Settings\\RKode\\Local Settings\\Temp\\BlUser";
CreateDir (szDirPath);
What would be the InstallScript equivalent of %USERPROFILE% ?
Or, how might I code the CreateDir so as to accomplish my goal ?
Thanks in advance all responses.
I DO appreciate all the help I can get,
Ray in Wisconsin
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

How to access the users profile TEMP folder
Started by
rkode
, Nov 27 2007 16:23
1 reply to this topic
Posted 04 December 2007 - 15:07
Hello again folks:
After some trial and error, I found the following code accomplished my goal.
Hope it may be helpful to someone else.
Ray in Wisconsin
/////////////////////////////////////////////////////////////////////////////////////////////
function GetLocOfTempFile(hMSI)
NUMBER nBufferSize;
STRING szTempFilePath;
begin
try
// Get the location of the TEMP folder for the currently logged on user
// NOTE: "TempFolder" is a MSI Installer property which returns the
// location of the currently logged on users "Temp" folder.
// Usually(but not always): c:\document and settings\?????\Local Settings\Temp
nBufferSize = MAX_PATH + 1;
MsiGetProperty(hMSI, "TempFolder", szTempFilePath, nBufferSize);
// At this point szTempFilePath contains "C:\Docume~1\?????\Local~1\Temp\"
catch
endcatch;
return ERROR_SUCCESS;
end;
////////////////////////////////////////////////////////////////////////////////////////////
After some trial and error, I found the following code accomplished my goal.
Hope it may be helpful to someone else.
Ray in Wisconsin
/////////////////////////////////////////////////////////////////////////////////////////////
function GetLocOfTempFile(hMSI)
NUMBER nBufferSize;
STRING szTempFilePath;
begin
try
// Get the location of the TEMP folder for the currently logged on user
// NOTE: "TempFolder" is a MSI Installer property which returns the
// location of the currently logged on users "Temp" folder.
// Usually(but not always): c:\document and settings\?????\Local Settings\Temp
nBufferSize = MAX_PATH + 1;
MsiGetProperty(hMSI, "TempFolder", szTempFilePath, nBufferSize);
// At this point szTempFilePath contains "C:\Docume~1\?????\Local~1\Temp\"
catch
endcatch;
return ERROR_SUCCESS;
end;
////////////////////////////////////////////////////////////////////////////////////////////