Archive: How to get the .exe file automatically and execute


How to get the .exe file automatically and execute
I want the NSIS installer search and automatically get the exe file in the target system and needs to execute, Whether it is possible? , If possible please post the code..........:rolleyes:


You can use the Locate plugin to find a file on the target system. Note that there's no guarantee that 'your' filename isn't used by some other application as well, so... Use with caution. Maybe add an md5 hashcheck or something?


can you give correct code for that I want to use that , I cant understand locate plugin:(:(


To learn NSIS, start with examining NSIS\Examples\Example1.nsi and Example2.nsi. Find out what all commands do, using the command reference: http://nsis.sourceforge.net/Docs/Chapter4.html

Once you know what all the commands in those Examples do, and why, you will be well on your way to understanding NSIS. In your particular case, you can find the required code in the locate plugin zip (Example\LocateTest.nsi).


Locate plug-in is here (wiki): http://nsis.sourceforge.net/Locate_plugin, forum thread here: http://forums.winamp.com/showthread....hreadid=224837

There are many examples, try to use one of them.


please any one can send locate plugin to my mail ID cgssankar@gmail.com because I can't able do download from source.....:rolleyes:


It's working fine: http://nsis.sourceforge.net/mediawik.../af/Locate.zip

If you can't download zip files at your work location, you won't be able to download it from gmail either.


I placed the required files for locate command in the application path and when I compile the following code,

Name "filefind"
OutFile Files.exe
!include "Locate.nsh"
Section
${Locate} "final/jre" "/L=F /M=jre1.exe" "Example1"
; 'RPC DCOM.rar' file in 'C:\ftp' with size 1 Kb or more

IfErrors 0 +2
MessageBox MB_OK "Error" IDOK +2
MessageBox MB_OK "$$R0=$R0"
SectionEnd

Function Example1
StrCpy $R0 $R9
; $R0="C:\ftp\files\RPC DCOM.rar"

MessageBox MB_YESNO '$R0$\n$\nFind next?' IDYES +2
StrCpy $0 StopLocate

Push $0
FunctionEnd

I got the error "Invalid command: ${locate}", Now what can I do?:rolleyes:


There is no "Locate" define in locate.nsh. Look at the example again.


I want to find jre.exe file which is in *\final\jre directory for that I am using the following section,

Section "Search for exe files"
${locate::Open} "*\final\jre" `/L=F /D=0 /M=*.exe /B=1` $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${locate::Find} $0 $1 $2 $3 $4 $5 $6

MessageBox MB_OKCANCEL '$$1 "path\name" =[$1]$\n\
$$2 "path" =[$2]$\n\
$$3 "name" =[$3]$\n\
$$4 "size" =[$4]$\n\
$$5 "time" =[$5]$\n\
$$6 "attributes =[$6]$\n\
$\n\
Find next?' IDOK loop
close:
${locate::Close} $0
${locate::Unload}
SectionEnd


but every time i got Error message only. can you give a correct syntax to get that exe file?...........:rolleyes:


Syntax of "Path" parameter is incorrect.

You cannot use "*\final\jre directory" but you need absolute path like "D:\Temp|C:\WINDOWS", ...

Read readme file, there is correct usage.