Indigo Rose Software

Professional Software Development Tools

 
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Feb 2004
    Posts
    19

    Please Help With File.Run I have Drawn a Complet Blank ...

    Hello.

    I have been trying for ages now and I have come to a dead end so I am turning to you chaps for help.

    On my startup action, i am trying to uninstall the previous version of my program before installing the new one.

    I know that the uninstall string is

    "C:\WINDOWS\myapp\uninstall.exe" "/U:C:\Program Files\myapp\irunin.xml"

    but I just cannot figure how to do it with File.Run

    Any help would be appreciated pus an example would be even better so I can save it for further use.

    Regards

  2. #2
    Join Date
    Jan 2000
    Posts
    2,002
    Something like:

    File.Run(_WindowsFolder.."\\myapp\\uninstall.exe", "/U:C:\Program Files\myapp\irunin.xml");

    should work.

  3. #3
    Join Date
    Feb 2004
    Posts
    19

    Bret please read if your there

    Hi

    When I run that i get a message box saying Invalid Uninstall Control File

    Any Ideas brett
    Last edited by whirl; 02-12-2005 at 02:40 PM. Reason: -

  4. #4
    Join Date
    Sep 2004
    Posts
    60
    Shouldn't that be

    File.Run(_WindowsFolder.."\\myapp\\uninstall.exe", "/U:C:\\Program Files\\myapp\\irunin.xml");

  5. #5
    Join Date
    Feb 2004
    Posts
    19

    Still failing

    Well this one really has me beat....

    Any other suggestions


  6. #6
    Join Date
    Sep 2004
    Posts
    60
    have you verified the existence of irunin.xml in the myapp folder?

  7. #7
    Join Date
    Feb 2004
    Posts
    19
    Yes, if i run it from a dos cmd line its fine


  8. #8
    Join Date
    Feb 2004
    Posts
    19
    I have just noticed that my folder where my app is has spaces

    c:\program files\my app\bla

    would this have anything to do with it ??

  9. #9
    Join Date
    Sep 2004
    Posts
    60
    Yes, that would be why it is not working

    [edit] Let me rephrase that, if you app folder name has spaces but your command line doesn't then that is why it is not working.
    Last edited by Absynthe; 02-12-2005 at 05:29 PM.

  10. #10
    Join Date
    Feb 2004
    Posts
    19
    Can you tell me how or if it can be fixed ?

  11. #11
    Join Date
    Jan 2000
    Posts
    2,002
    Quote Originally Posted by Absynthe
    Shouldn't that be

    File.Run(_WindowsFolder.."\\myapp\\uninstall.exe", "/U:C:\\Program Files\\myapp\\irunin.xml");
    RIGHT! Try that. It should work. I forgot to escape the quotes in the second part.

  12. #12
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    whirl, I think you still will have the error message "Invalid Uninstall Control File".

    The arguments to File.Run must be:

    /U:"C:\\Program Files\\My App\\irunin.xml"

    and has to be enclosed in quotes (string value), but you can't use:
    "/U:"C:\\Program Files\\My App\\irunin.xml""

    Either you have to escape the double quotes within the string:

    "/U:\"\"D:\\Program Files\\plusAVSKRIV\\PD_Avinstall.xml\""

    or you have to combine with single quotes:

    '/U:"C:\\Program Files\\My App\\irunin.xml"'

    I have attached a sample program; you can easily try the various arguments. (The default file names may be adjusted in 'On Startup'.)

    I have worked a bit with the uninstall command by reason of
    i) To be able to start an uninstall from a setup executable (your case)
    ii) To be able to have the uninstall shortcut in a shortcut subfolder (then I have to create the shortcut manually) because "Uninstall" would be the first option on the Windows start menu when you live outside an English-spoken country (due to the Windows shortcut sort order).
    Attached Files

  13. #13
    Join Date
    Feb 2004
    Posts
    19
    Hello

    Thank you very much, with your example, I have managed to get it to uninstall.

    I didn't know about using the single quotes ' '

    Thankyou for taking thre time to show me how to achieve this.

    All the best.

  14. #14
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    No problems; in fact it is a pleasure to return something to the I.R. Forums. I have learned a lot from this source.

    BTW, the combination of double/single quotes is a nice way to make the code more readable - in any language! The double quotes with escaped double quotes require that you have had your morning coffee…

  15. #15
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    Quote Originally Posted by whirl
    On my startup action, i am trying to uninstall the previous version of my program before installing the new one
    I ran into whirl's scenario before I expected. I thought that the easiest way was to read the 'UninstallString' in the Registry, rather the constructing the commandline as explained in postcount #12. A query might give results like this:

    From SUF60:
    C:\WINDOWS\iun6002.exe "C:\CompanyName\ProductName\irunin.ini"

    From SUF70:
    "C:\WINDOWS\SUF70 Program Flow\uninstall.exe" "/U:C:\Program Files\SUF70 Program Flow\Uninstall\uninstall.xml"

    These strings can be entered at command prompt to start the uninstaller.

    I intended to use
    File.Run(sCommand, sArguments, "", SW_SHOWNORMAL, true);
    where
    sCommand = "C:\WINDOWS\SUF70 Program Flow\uninstall.exe"
    sArguments = "/U:C:\Program Files\SUF70 Program Flow\Uninstall\uninstall.xml"

    Naturally I had to replace the single backslash with double backslashes in both variables. In addition I had to remove the quotes in the command (sCommand = C:\\WINDOWS\\SUF70 Program Flow\\uninstall.exe)

    I didn't expect this should work due to the spaces in the path, but the fact is: It works; and it is the only syntax that is usable. If I use sCommand = " C:\\WINDOWS\\SUF70 Program Flow\\uninstall.exe" I'll get Error 1013 File execution failed.

    I try to understand and my question is:

    Does File.Run() automatically add double quotes to the "Filename" = "(string) The path to the executable (.exe) file."?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. File.Run with executable arguments
    By dfahey in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 11-22-2004, 12:34 PM
  2. Create a blank file on users system
    By kpsmith in forum AutoPlay Media Studio 4.0
    Replies: 3
    Last Post: 11-08-2002, 08:32 AM
  3. "Delete Text Line" also adds a blank line at EOF
    By alian007 in forum Setup Factory 6.0
    Replies: 1
    Last Post: 07-30-2002, 11:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts