Archive: Set the environment variable to the app folder


Set the environment variable to the app folder
Hi,

I'm new user to Nsis ;]

Sometimes you have to copy files For example: to %programdata% (C:\ProgramData)
before you launch the main program (executable file).

How to Set the environment variable to the app folder location so all

files and folders the program creates are redirected to the app folder location.


In other words, in place of copying a file to Windows directory, just redirected to the app folder and then lunch the executable file.



Thanks in advance.


I don't understand what you're trying to say. If you're asking how to change the directory where NSIS extracts its files: That's what SetOutPath is for.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.9


MSG thank you very much for your quick reply.

I trying to make a launcher for program called Kleptomania( http://www.structurise.com/kleptomania/index.shtml)
which allows you to capture and process images and text.

To run the program you should first copy the k-mania.Ini to C:\Windows and then you can
launch the program.

So what I'm trying to do is. In place of copying a file to Windows directory, I want to

redirected k-mania.Ini to the app folder and then lunch the executable file.



This is an example of the script.

Section "Main"

CopyFiles /SILENT "$EXEDIR\Appdata\k-mania.Ini" "$WINDIR"
Sleep 300

ExecWait "$EXEDIR\Appdata\k-mania.exe"

CopyFiles /SILENT "$WINDIR\k-mania.Ini" "$EXEDIR\Appdata\"
Sleep 500

Delete "$WINDIR\k-mania.Ini"

SectionEnd


Here is an example from autohotkey community (http://www.autohotkey.com/community/...ic.php?t=56697


Thank you for your patience.


Mike


Ah, so you want to redirect your application's read/write calls to another directory? I don't know any way to do this, but I don't think this is really an NSIS question. You might be better off hacking the application's exe to look for the ini file in another directory.

(Note that you should never change the value of %WINDIR%, as that would break lots of applications massively.)