Announcement

Collapse
No announcement yet.

How to run setup.exe as if from command window

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to run setup.exe as if from command window

    Our software doesn't like to install from a CD (actually we are up to a DVD). It tries to write the log file back to the DVD and because it can't it doesn't install some needed files.

    However if I go to a command prompt window and then run it from the DVD it works, like this;
    C:\Windows\Temp>f:\autoplay\software\setup.exe
    because then it can write the log file.

    So on the script for the button I put this;
    01 "Folder.SetCurrent("C:\\Windows\Temp");
    02 result = File.Run("AutoPlay\\Software\\Setup.exe", "C:\\Windows\\Temp", "", SW_SHOWNORMAL, false);

    I hoped the double redundancy would help but it didn't. It still wants to write the log in the wrong place and so doesn't install completely.

    Is there some way to do run an install as if I am running it from the hard drive, like a command window? I would rather not copy it to the hard drive and run from there because that takes too much time.

    Thanks
    Lee

  • #2
    "Folder.SetCurrent("C:\\Windows\Temp");
    Two errors here. First, you should never use a hard coded path. No but, not now, not today, not ever. Simply don't. Second, there is a backslash missing, so the action won't probably work as expected because the folder does not exist.

    The proper way is this:

    Code:
    Folder.SetCurrent(_TempFolder);
    result = File.Run("AutoPlay\\Software\\Setup.exe", "C:\\Windows\\Temp", "", SW_SHOWNORMAL, false);
    Apart from using hard coded paths again, another problem is that you are passing "C:\\Windows\\Temp" as the command line argument to Setup.exe instead of setting the work folder for File.Run(), which would be the third argument. The proper way is:

    Code:
    File.Run("AutoPlay\\Software\\Setup.exe", "", _TempFolder, SW_SHOWNORMAL, false);
    You should only need this second code.

    Ulrich

    Comment


    • #3
      Thank you, that was my solution. I appreciate the help I get.
      Lee

      Comment

      Working...
      X