Archive: Running .exe files


Running .exe files
I'm working on an update for a language pack. The old team is long gone and my only co-worker is just a translator, so I have no access to source codes.

The problem is - I have to run an exe during instalation. It modifies a file about 1.7 GB big in an unknown way (since I have no source code and can't view a file this big with Notepad++).

If I run the exe myself, just double-clicking it, everything goes fine in any directory.
If I move both exe and big file to desktop, it also works perfectly using ExecShell.
If I try ExecShell in the original directory (C:\Program Files\...), the exe file reports, that it couldn't access a file to modify.

So any ideas what's wrong? If I run that exe from Program Files myself, it works just fine. Something about admin rights?
I tried setting RequestExecutionLevel to both admin & highest, but it didn't help.

Also - I've noticed the same problems with ExecWait and Exec. All of them fail in Program Files subdirectories.

Just an amusing fact - I tried InstallShield installer, set the exe to "Run when installer closes" (checkbox on the last page) and it worked ok, overcoming execution restrictions.
But it's not an estetic way to let user uncheck execution of mandatory operations, so I'd rather look for a NSIS-based solution.

Thanks in advance.


First of all: Program Files is a protected directory. You need administrator access to modify files there.

Second: requestexecutionlevel does nothing on WinXP and earlier, or when UAC is turned off in Vista/7. You need to use the UserInfo plugin to verify that the installer has admin access.

Third: Perhaps you need to set the working directory before you execute? Use SetOutPath.


Wow, thanks, it helped. I didn't even have to use the plugin.

It was just setting the proper outpath...

The problem was that I installed the exe to $INSTDIR, then SetOutPath to $INSTDIR\videos

I had no idea, it could mess things up, so thanks again. :)