Error code running a DOS command.

Got a problem you cannot solve? Try here.
Post Reply
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Error code running a DOS command.

Post by bokkie »

Guys, could someone explain why my snippet below does not work? I check if a file exists and it successfully returns TRUE to variable DLLEXISTS. I then check the variable returned and if it's TRUE I then run a DOS command that renames the file. I do this before the Apply Install is run. If I manually run the command in a DOS window it works and the DOS %errorlevel% result is 0, confirming it works. But if I run the command using the Run Program As statement, it does not. It returns error code -11. I'm a bit stumped. Can anyone explain what I'm doing wrong?

[DEFINE WEB MEDIA P1 - Cache sockets break-fix]
Get Component P1 - Cache sockets break-fix Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
end
Comment: TO-DO: Insert any additional install commands here
Set Variable DLLEXISTS to
Does File Exist C:\\Program Files\\ACE cache\\ACE.Apollo.Framework.CacheSockets.dll (get result into variable DLLEXISTS)
if Variable DLLEXISTS Equals TRUE
Set Variable COPYRESULT to
Run Program rename "C:\\Program Files\\ACE cache\\ACE.Apollo.Framework.CacheSockets.dll" ACE.Apollo.Framework.CacheSockets.dll.PreP1BreakFix, startup in folder "C:\\Program Files\\ACE cache" (WAIT, get result into variable COPYRESULT)
MessageBox: Copy result, $COPYRESULT$
end

[compiler if Variable BUILDMODE Equals PATCH]
Apply Patch (get result into variable SUCCESS)
[compiler else]
if Variable ADVERTISE Equals TRUE
Apply Advertised (get result into variable SUCCESS)
else
Apply Install (get result into variable SUCCESS)
end
[compiler end]
Set Variable PROGRESS to 100
end
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Post by bokkie »

I also tried another approach. I have an existing file called C:\\Temp\\1. In bold below are the statements I'm using. On the Apply Install I move file 1 to file 2. That works and file 1 was moved to file 2. On the Apply Uninstall I then move file 2 to file 3. However, that does not work. I reckon I'm being a dork but I'm not sure what to try or do.

Comment: Modify Target System
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
Comment: Uninstall product
Comment: TO-DO: Insert any additional uninstall commands here
Move Local Files C:\\Temp\\2 to C:\\Temp\\3
Apply Uninstall (get result into variable SUCCESS)

Set Variable PROGRESS to 100
else
<<Code>>
[DEFINE REGION: Perform First Time or Maintenance Installation]
Comment: Install/Re-Install product
Create Shortcut $SHORTCUTFOLDER$\\Uninstall #TITLE# to $UNINSTALLLINK$
[OFFLINE CONTENT]
[DEFINE WEB MEDIA P1 - Cache sockets break-fix]
Get Component P1 - Cache sockets break-fix Selection State into Variable SELECTED
if Variable SELECTED Equals TRUE
end
Comment: TO-DO: Insert any additional install commands here
[compiler if Variable BUILDMODE Equals PATCH]
Apply Patch (get result into variable SUCCESS)
[compiler else]
if Variable ADVERTISE Equals TRUE
Apply Advertised (get result into variable SUCCESS)
else
Move Local Files C:\\Temp\\1 to C:\\Temp\\2
Apply Install (get result into variable SUCCESS)

end
[compiler end]
Set Variable PROGRESS to 100
end
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

There's an exact help file topic discussing this :) Please read "setup commands preceding Apply Uninstall" for a detailed overview.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Post by bokkie »

Michael,

I shall do so. I got a bit buried with things at work to do today. I did not have the luxury of time on my side. Now that I'm home, I can chill out and research what you mentioned.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

Also, please take a look at the MSIcode whitepaper. It contains an even more in-depth discussion of what you are experiencing.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
bokkie
Posts: 767
Joined: Sun Feb 08, 2009 6:30 am

Post by bokkie »

I'll read that again as well. I was also thinking about the call dll function. Some years ago, I used to have Dan Appelman's (???) book on the windows api. Do you know of any web sites that have something equivalent and which might have code samples as well?
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

On API calls - our built-in samples have some great examples for copying files, etc. directly via the API. Just check them out - the embedded comments on top of each sample discusses techniques exposed in the sample, so it will be easy to find and well worth your while!
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Post Reply