prevent %TEMP% replacement
prevent %TEMP% replacement
Hi,
I got a question.
We want to create a shortcut on the desktop with a "start in" folder pointing to %TEMP%. Please note we really mean the environmental variable %TEMP% and not the actual temp folder.
After installation the shortcut always gets replaced with the actual temp folder. (See attachement "Wrong shortcut"). We've tried several ways to think of a workaround. Without any success.
Any suggestions?
We are using IA15.
Best regards,
Jeroen Vleeming
Omnitrans International
I got a question.
We want to create a shortcut on the desktop with a "start in" folder pointing to %TEMP%. Please note we really mean the environmental variable %TEMP% and not the actual temp folder.
After installation the shortcut always gets replaced with the actual temp folder. (See attachement "Wrong shortcut"). We've tried several ways to think of a workaround. Without any success.
Any suggestions?
We are using IA15.
Best regards,
Jeroen Vleeming
Omnitrans International
- Attachments
-
- Desired shortcut
- shortcut example2.png (41.24 KiB) Viewed 14214 times
-
- Wrong shortcut
- shortcut example.png (41.9 KiB) Viewed 14214 times
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
Dear Jeroen,
I may suggest you a workaround for this ( ... I used the same some time ago and worked fine).
1) Get the value of the SYSTEM %TEMP% Environment variable from REGISTRY. This is stored under;
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Use the READ REGISTRY KEY command to store the SYSTEM %TEMP% value in a variable.
2) Then use the returned variable value to specify the "Startup In Folder" with the Create Shortcut command.
Hope this helps you.
Regards
I may suggest you a workaround for this ( ... I used the same some time ago and worked fine).
1) Get the value of the SYSTEM %TEMP% Environment variable from REGISTRY. This is stored under;
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Use the READ REGISTRY KEY command to store the SYSTEM %TEMP% value in a variable.
2) Then use the returned variable value to specify the "Startup In Folder" with the Create Shortcut command.
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
Hi Francesco,
The user independent temp folder in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment (usually c:\windows\temp) is always accessible for any user? Or can sys-admins remove the write permission? We need to have access to a writable temp directory.
If you take HEY_CURRENY_USER\Environment\Temp as value in the shortcut,the temp directory is invalid when another user is executing the shortcut. So this is not an option. (It is same the solution as using %TEMP%)
Best Regards,
Jeroen
The user independent temp folder in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment (usually c:\windows\temp) is always accessible for any user? Or can sys-admins remove the write permission? We need to have access to a writable temp directory.
If you take HEY_CURRENY_USER\Environment\Temp as value in the shortcut,the temp directory is invalid when another user is executing the shortcut. So this is not an option. (It is same the solution as using %TEMP%)
Best Regards,
Jeroen
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
Dear Jeroen,
yes, the temp folder pointed by "in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" should be available to any user.
Regards
Francesco
yes, the temp folder pointed by "in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" should be available to any user.
Regards
Francesco
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
We've release a beta version which creates shortcut with a start in folder based on the HKEY_LOCAL_MACHINE Temp settings (usually evaluating to c:\windows\temp).
On our PC it works fine, however on the PC of one of our BETA tester our software doesn't work fine.
Is the replacement done by IA or by Windows Installer?
If done by Installer, can we prevent %TEMP% being replaced using escape commands? like discussed in http://msdn.microsoft.com/en-us/library ... 85%29.aspx
If possible please provide an example.
Best regards,
Jeroen
On our PC it works fine, however on the PC of one of our BETA tester our software doesn't work fine.
Is the replacement done by IA or by Windows Installer?
If done by Installer, can we prevent %TEMP% being replaced using escape commands? like discussed in http://msdn.microsoft.com/en-us/library ... 85%29.aspx
If possible please provide an example.
Best regards,
Jeroen
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
Dear Jeroen,
I'm sorry but I am not sure to fully understand your question.
Which is exactly the value returned from the REG KEY?
Regards
I'm sorry but I am not sure to fully understand your question.
Which is exactly the value returned from the REG KEY?
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
Francesco,
I've added this in my MSI code
~InstallAware Clipboard Data~
~Read Registry~
~{2708FB73-58EA-4B9F-BF07-F8A2919456ED}~
~SystemTemp~
~2~
~SYSTEM\CurrentControlSet\Control\Session Manager\Environment~
~TEMP~
and created a shortcut with "start in folder" pointing to SystemTemp variable.
After installation the shortcut is created and evalates to c:\windows\temp (in my case and as well for the BETA tester), but apparently this solution is not working (c:\window\temp in stead of %TEMP%) for our BETA tester. OUR software works fine on my PC with this "start in folder". Our BETA tester gets errors in our SW. When he after installation manually changes the start in folder to %TEMP% everything works fine again.
So %TEMP% works, c:\windows\temp doesn't.
Is there any other way to force that the shortcut is created with %TEMP%?
Sniplet from http://msdn.microsoft.com/en-us/library ... 85%29.aspx
-----------
If a substring of the form [%environmentvariable] is found, the value of the environment variable is substituted for the substring.
If a substring of the form [\x] is found, it is replaced by the character x , where x is one character, without any further processing. Only the first character after the backslash is kept; everything else is removed. For example, to include a literal left bracket ([), use [\[]. The text [\[]Bracket Text[\]] resolves to [Bracket Text].
------------
Is there a way to not let the installer substitute the environment variable, like [\%]TEMP[\%] -> %TEMP%?
Jeroen
I've added this in my MSI code
~InstallAware Clipboard Data~
~Read Registry~
~{2708FB73-58EA-4B9F-BF07-F8A2919456ED}~
~SystemTemp~
~2~
~SYSTEM\CurrentControlSet\Control\Session Manager\Environment~
~TEMP~
and created a shortcut with "start in folder" pointing to SystemTemp variable.
After installation the shortcut is created and evalates to c:\windows\temp (in my case and as well for the BETA tester), but apparently this solution is not working (c:\window\temp in stead of %TEMP%) for our BETA tester. OUR software works fine on my PC with this "start in folder". Our BETA tester gets errors in our SW. When he after installation manually changes the start in folder to %TEMP% everything works fine again.
So %TEMP% works, c:\windows\temp doesn't.
Is there any other way to force that the shortcut is created with %TEMP%?
Sniplet from http://msdn.microsoft.com/en-us/library ... 85%29.aspx
-----------
If a substring of the form [%environmentvariable] is found, the value of the environment variable is substituted for the substring.
If a substring of the form [\x] is found, it is replaced by the character x , where x is one character, without any further processing. Only the first character after the backslash is kept; everything else is removed. For example, to include a literal left bracket ([), use [\[]. The text [\[]Bracket Text[\]] resolves to [Bracket Text].
------------
Is there a way to not let the installer substitute the environment variable, like [\%]TEMP[\%] -> %TEMP%?
Jeroen
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
Dear Jeroen,
why don't you try with?
The same in redable format;
Regards
why don't you try with?
Code: Select all
~InstallAware Clipboard Data~
~End~
~{DB5E582D-E5DA-43E7-B3E9-FFE7F0C9AA88}~
~Replace String~
~{C43DFD04-C6C4-4DAF-97CA-0F80515B474A}~
~MYTEMP~
~[\%]~
~%~
~TRUE~
~TRUE~
~If~
~{B207A015-8066-4F44-AE99-F58AB19ABD9D}~
~MYTEMP~
~3~
~[\%]~
~FALSE~
~Set Variable~
~{B104CF39-9E40-48C7-BC51-986E920D1FBC}~
~MYTEMP$MYAH$MYAH$FALSE~
~[\%]TEMP[\%]~
Code: Select all
Set Variable MYTEMP to [\%]TEMP[\%]
if Variable MYTEMP Contains (Ignore Case) [\%]
Replace [\%] with % in variable MYTEMP
end
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
Francesco,
Your suggestion doesn't lead to preventing %TEMP% being substituted by the actual user temp path.
The substitution is made by the windows installer itself, I guess.
Other suggestions please.
Best regards,
Jeroen
Your suggestion doesn't lead to preventing %TEMP% being substituted by the actual user temp path.
The substitution is made by the windows installer itself, I guess.
Other suggestions please.
Best regards,
Jeroen
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
Dera Jerom,
with all my tests the value returned by the TEMP key under "HKLM\YSTEM\CurrentControlSet\Control\Session Manager\Environment", it is always;
"%SystemRoot%\TEMP".
Using this value with the shortcut creation command, it remains as entered and it is not resolved to the physical path string.
So with my shortcut Target property I have; "%SystemRoot%\TEMP\dummy.rtf".
Instead if I use %TEMP% with the shortcut creation, it still remains as entered and it is not resolved to the physical path string but it points, to the defined TEMP user account environment variable.
Honestly, I don't know if the above behavior can be different with other OSes (I used WIN 7 x64) but of course, I haven't found it resolved by the Windows Installer Engine.
Regards
with all my tests the value returned by the TEMP key under "HKLM\YSTEM\CurrentControlSet\Control\Session Manager\Environment", it is always;
"%SystemRoot%\TEMP".
Using this value with the shortcut creation command, it remains as entered and it is not resolved to the physical path string.
So with my shortcut Target property I have; "%SystemRoot%\TEMP\dummy.rtf".
Instead if I use %TEMP% with the shortcut creation, it still remains as entered and it is not resolved to the physical path string but it points, to the defined TEMP user account environment variable.
Honestly, I don't know if the above behavior can be different with other OSes (I used WIN 7 x64) but of course, I haven't found it resolved by the Windows Installer Engine.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
Ok, for some reason the %TEMP% does get substituted on our PCs and not on yours.
Now we only need to figure out why.
When I add some messageboxes in IA displaying the temp variable is shows the desired value (%TEMP%) but after installation the shortcut is created with the phycial path again.
I use Win7 with SP1 x64. My msiexec version is Windows ® Installer. V 5.0.7601.17514
Now we only need to figure out why.
When I add some messageboxes in IA displaying the temp variable is shows the desired value (%TEMP%) but after installation the shortcut is created with the phycial path again.
I use Win7 with SP1 x64. My msiexec version is Windows ® Installer. V 5.0.7601.17514
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
... exactly the same configuration I used to test.
Let me see if I am able to find anything about the behavior you seem to have.
It will be useful, If you could post a very minimal project that shows the way you used ( ... to be sure that both of us use the same approach).
Regards
Let me see if I am able to find anything about the behavior you seem to have.
It will be useful, If you could post a very minimal project that shows the way you used ( ... to be sure that both of us use the same approach).
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
I just created a new test installer project (see attachment) based on the quick start wizard.
I put %TEMP% in the "start in folder" of the uninstall shortcut.
After generating a single file and running this generated exe, a shortcut is created in the start menu (Testshortcut)
Looking at the properties of this shortcut the start in folder points to..... C:\Users\OTI\AppData\Local\Temp in stead of %TEMP%
I put %TEMP% in the "start in folder" of the uninstall shortcut.
After generating a single file and running this generated exe, a shortcut is created in the start menu (Testshortcut)
Looking at the properties of this shortcut the start in folder points to..... C:\Users\OTI\AppData\Local\Temp in stead of %TEMP%
- Attachments
-
- InputTest.zip
- (1.79 MiB) Downloaded 514 times
-
FrancescoT
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: prevent %TEMP% replacement
Dera Jeroen,
please be patient (it's really a busy period) ... I'll be back as soon as possible.
Regards.
please be patient (it's really a busy period) ... I'll be back as soon as possible.
Regards.
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: prevent %TEMP% replacement
Francesco,
Any progress?
Jeroen
Any progress?
Jeroen

