This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: How to use %ALLUSERSPROFILE% environment variable in InstallScipt
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 25, 2014
01:31 AM
How to use %ALLUSERSPROFILE% environment variable in InstallScipt
Hi
I have an install script in which I want to open a file located at %ALLUSERSPROFILE%\MyFolder
So I used this code:
set oDoc = CreateObject("Microsoft.XMLDOM");
.
.
.
if (oDoc.load("[ALLUSERSPROFILE]\\MyFolder\\TestFile.xml")) then
.
.
.
But this is not working. Although I have created the folder %ALLUSERSPROFILE%\MyFolder in Application Data > Files and Folders and that folder creates successfully. I also copy the file TestFile.xml over there and it also shows up after the install. But when the code does not seem to have any effect in the file since I am trying to open it and edit it in %ALLUSERSPROFILE%\MyFolder. I have tried by copying this file in the INSTALLDIR location and open and edit there and that works fine so there does not seem to be a problem with my code.
I think I am using the wrong variable in the path which is [ALLUSERSPROFILE].
Can anyone tell me how to I access the %ALLUSERSPROFILE% location in the install script.
Many Thanks,
Adeel.
I have an install script in which I want to open a file located at %ALLUSERSPROFILE%\MyFolder
So I used this code:
set oDoc = CreateObject("Microsoft.XMLDOM");
.
.
.
if (oDoc.load("[ALLUSERSPROFILE]\\MyFolder\\TestFile.xml")) then
.
.
.
But this is not working. Although I have created the folder %ALLUSERSPROFILE%\MyFolder in Application Data > Files and Folders and that folder creates successfully. I also copy the file TestFile.xml over there and it also shows up after the install. But when the code does not seem to have any effect in the file since I am trying to open it and edit it in %ALLUSERSPROFILE%\MyFolder. I have tried by copying this file in the INSTALLDIR location and open and edit there and that works fine so there does not seem to be a problem with my code.
I think I am using the wrong variable in the path which is [ALLUSERSPROFILE].
Can anyone tell me how to I access the %ALLUSERSPROFILE% location in the install script.
Many Thanks,
Adeel.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 30, 2014
08:53 AM
Adeel,
If you have an InstallScript project, that variable will not work (see the bottom of this link: http://helpnet.installshield.com/installshield18helplib/IConvertScriptToPro.htm at "The following Windows Installer folder specifiers are not supported in InstallScript projects:"). Unfortunately, I don't know what the equivalent variable would be in an InstallScript project - perhaps someone else can help with that.
You may want to add a temporary debug messagebox to see the actual file path you are passing:
[CODE]MessageBox( "[ALLUSERSPROFILE]\\MyFolder\\TestFile.xml", INFORMATION );[/CODE]
Also, you may want to use the newer the newer "MSXML2.DOMDocument.6.0" instead of "Microsoft.XMLDOM".
HTH
If you have an InstallScript project, that variable will not work (see the bottom of this link: http://helpnet.installshield.com/installshield18helplib/IConvertScriptToPro.htm at "The following Windows Installer folder specifiers are not supported in InstallScript projects:"). Unfortunately, I don't know what the equivalent variable would be in an InstallScript project - perhaps someone else can help with that.
You may want to add a temporary debug messagebox to see the actual file path you are passing:
[CODE]MessageBox( "[ALLUSERSPROFILE]\\MyFolder\\TestFile.xml", INFORMATION );[/CODE]
Also, you may want to use the newer the newer "MSXML2.DOMDocument.6.0" instead of "Microsoft.XMLDOM".
HTH