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: Batch File Not Executing in IS2008
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 26, 2007
10:39 AM
Batch File Not Executing in IS2008
I realize that there are some updates in IS2008 regarding CAs and InstallScript. Although... I'm not sure why this isn't working.
Here is my function.
<><><>
function MyFunction(hMSI)
STRING svBatFile, svStatus;
STRING svBatDir, szMsg;
NUMBER nBuffer;
begin
MsiGetProperty(hMSI, "BKS_SW_DIR", svBatDir, nBuffer);
svBatFile = svBatDir ^ "MyBatch.bat";
SetStatusText("Batch File Path = " + svBatFile);
Delay(2);
if (LaunchAppAndWait(svBatFile, "", WAIT) < 0) then
MessageBox("Unable to execute batch script...", SEVERE);
endif;
end;
<><><>
The status text shows that the path being generated is correct... but the LAAW action fails. 😞
This worked fine in version 10.5 and in DevStudio 9... What am I doing wrong that it doesn't work in IS2008? :mad:
I'm using a Basic MSI project type as this function will be a part of a much bigger install.
Thanks.
Here is my function.
<><><>
function MyFunction(hMSI)
STRING svBatFile, svStatus;
STRING svBatDir, szMsg;
NUMBER nBuffer;
begin
MsiGetProperty(hMSI, "BKS_SW_DIR", svBatDir, nBuffer);
svBatFile = svBatDir ^ "MyBatch.bat";
SetStatusText("Batch File Path = " + svBatFile);
Delay(2);
if (LaunchAppAndWait(svBatFile, "", WAIT) < 0) then
MessageBox("Unable to execute batch script...", SEVERE);
endif;
end;
<><><>
The status text shows that the path being generated is correct... but the LAAW action fails. 😞
This worked fine in version 10.5 and in DevStudio 9... What am I doing wrong that it doesn't work in IS2008? :mad:
I'm using a Basic MSI project type as this function will be a part of a much bigger install.
Thanks.
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 26, 2007
01:01 PM
I had the same problem.
What's strange is the same script was working at one point, and then just stopped.
I have a 3rd party installation I launch that was defaulting to H:\ when it should be C:\ on some computers. I suspect it's due to our network here having every computer setup with a share on H:\. I've seen this behavior before with a Sentinel driver install.
Anyhow, in attempting to address that issue, I used ChangeDirectory:
ChangeDirectory( TARGETDISK + "\\" );
szPath = TARGETDISK + "\\";
LAAW_PARAMETERS.lpCurrentDirectory = &szPath;
In hopes of it grabbing the root drive that has win.ini (C:\ in most cases).
I haven't been able to test that fix since the machine I use is in another state and my build is copying (2 hours!), but I decided to use just ChangeDirectory (LocationOfBatchFile) before each LAAW call on each batch file using a test box here at my location.
They executed properly.
What's strange is the same script was working at one point, and then just stopped.
I have a 3rd party installation I launch that was defaulting to H:\ when it should be C:\ on some computers. I suspect it's due to our network here having every computer setup with a share on H:\. I've seen this behavior before with a Sentinel driver install.
Anyhow, in attempting to address that issue, I used ChangeDirectory:
ChangeDirectory( TARGETDISK + "\\" );
szPath = TARGETDISK + "\\";
LAAW_PARAMETERS.lpCurrentDirectory = &szPath;
In hopes of it grabbing the root drive that has win.ini (C:\ in most cases).
I haven't been able to test that fix since the machine I use is in another state and my build is copying (2 hours!), but I decided to use just ChangeDirectory (LocationOfBatchFile) before each LAAW call on each batch file using a test box here at my location.
They executed properly.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 26, 2007
02:16 PM
Added that block in without success.
As I mentioned... the path for the batchfile looks shows that it is initialized correctly. The test project I have is very simple... just creates the folder location in itne program files folder, dumps the batch file into the folder and then the CA is called with a Exec - AfterInstallFiles sequence.
I use Immediate Execution. If I use Deferred Execution, the path is not correctly initialized as would be expected and so the script call fails as well.
:mad: :mad: :mad:
So I'm still at square one??? Maybe I should fall back to IS10.5... This seems like a pretty simple tasks and for IS2008 to not be able to handle it make me want to seriously consider moving over to the Symantic install tool!
As I mentioned... the path for the batchfile looks shows that it is initialized correctly. The test project I have is very simple... just creates the folder location in itne program files folder, dumps the batch file into the folder and then the CA is called with a Exec - AfterInstallFiles sequence.
I use Immediate Execution. If I use Deferred Execution, the path is not correctly initialized as would be expected and so the script call fails as well.
:mad: :mad: :mad:
So I'm still at square one??? Maybe I should fall back to IS10.5... This seems like a pretty simple tasks and for IS2008 to not be able to handle it make me want to seriously consider moving over to the Symantic install tool!
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 26, 2007
02:51 PM
There have been some changes to the InstallScript architecture starting with InstallShield 12; please see the sticky posts at the top of this forum.
If you want to launch a file that you're installing, it will need to be in deferred mode, since files and other data aren't written until deferred mode. And to get a property value using MsiGetProperty during deferred mode, you'll need to go through CustomActionData, about which see the links in the what's-new posts or search these forums.
(As an aside, you might see if it's an option to launch the batch file directly using a launch-an-EXE custom action; please search the forums and KB for "batch file custom action" for some approaches.)
If you want to launch a file that you're installing, it will need to be in deferred mode, since files and other data aren't written until deferred mode. And to get a property value using MsiGetProperty during deferred mode, you'll need to go through CustomActionData, about which see the links in the what's-new posts or search these forums.
(As an aside, you might see if it's an option to launch the batch file directly using a launch-an-EXE custom action; please search the forums and KB for "batch file custom action" for some approaches.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 26, 2007
04:11 PM
Try launching cmd.exe instead of the batch file. e.g. cmd.exe /c MyBatch.bat. If you support Win9x then cmd.exe won't be present and you'll have to use command.com instead. I think the COMSPEC environment variable will contain the correct command processor - cmd.exe on WinNT or command.com on Win9x.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 26, 2007
07:59 PM
Thanks for the suggestions...
The project is set to work for XP or 2003 boxes only. I've tried the full qualification approach as well without success.
I can also execute the batch file from the run box by giving it the full path and not using the executable name so I would assume that all of the environment variables are set as required.
So... there is something else I'm missing.
Will logging or debugging give me more information?
I'll try some other options... but it still appears that reverting to an older versions of IS is the best option.
The project is set to work for XP or 2003 boxes only. I've tried the full qualification approach as well without success.
I can also execute the batch file from the run box by giving it the full path and not using the executable name so I would assume that all of the environment variables are set as required.
So... there is something else I'm missing.
Will logging or debugging give me more information?
I'll try some other options... but it still appears that reverting to an older versions of IS is the best option.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 26, 2007
09:43 PM
Logging/debugging won't help. The issue is that there are only 3 properties that can be accessed by a CA running in deferred mode: CustomActionData, ProductCode, and UserSID. The CustomActionData is a way to pass data from a CA running in immediate mode to a CA running in deferred mode. Based on your example that might not be necessary though. If I have time tomorrow I'll setup an example project for you.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 27, 2007
11:18 AM
Okay, here's an example. There are two custom actions that call a batch file. The first one uses the run an executable custom action type which will work if you don't need to do any complex processing before running the batch file. The second one uses InstallScript to launch the batch file.
Hope this helps.
Hope this helps.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 28, 2007
12:32 AM
Thanks K
I'll try it first thing tomorrow on my work system... I appreciate your effort in trying to help.
S
I'll try it first thing tomorrow on my work system... I appreciate your effort in trying to help.
S
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 06, 2007
11:53 AM
It took me longer to try out your suggestions than I had hoped. Other tasks on the project were a higher priority. But finally tried out the fixes. Your examples did work on my system. Thanks again for the help.
![](/skins/images/A5EADE085F77DE82FB3B14D6B307AE6A/responsive_peak/images/icon_anonymous_message.png)