GetExePath: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.)
m (Updated author links.)
Line 1: Line 1:
{|align=right
|<small>Author: [[{{ns:2}}:Instructor|Instructor]] ([[{{ns:3}}:Instructor|talk]], [[{{ns:-1}}:Contributions/Instructor|contrib]])</small>
|}
<br style="clear:both;">
== Links ==
== Links ==
; Latest version of headers "nsh.zip":
; Latest version of headers "nsh.zip":
Line 61: Line 65:
FunctionEnd
FunctionEnd
</highlight-nsis>
</highlight-nsis>
Page author: [[User:Instructor|Instructor]]

Revision as of 02:57, 30 April 2005

Author: Instructor (talk, contrib)


Links

Latest version of headers "nsh.zip"
http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost

If function used without header then put function in script before call it

The Function

/*
____________________________________________________________________________
 
                            GetExePath
____________________________________________________________________________
 
2004 Shengalts Aleksander (Shengalts@mail.ru)
 
 
Get installer pathname ($EXEDIR with valid case for Windows 9X)
 
 
Syntax:
Call GetExePath         ; Call function
Pop $var                ; $var=installer pathname
 
 
Example:
Section
	Call GetExePath
	Pop $R0   ; $R0="C:\ftp"
SectionEnd*/
 
 
;---------------------------------------------------------------------------
Function GetExePath
	Push $0
	Push $1
	Push $2
 
	StrCpy $1 $CMDLINE 1
	StrCmp $1 '"' 0 exedir
	StrCpy $1 0
	IntOp $1 $1 + 1
	StrCpy $0 $CMDLINE 1 $1
	StrCmp $0 '"' 0 -2
	IntOp $1 $1 - 1
	StrCpy $0 $CMDLINE $1 1
 
	StrCpy $1 0
	IntOp $1 $1 - 1
	StrCpy $2 $0 1 $1
	StrCmp $2 '\' 0 -2
	StrCpy $0 $0 $1
	goto end
 
	exedir:
	StrCpy $0 $EXEDIR
 
	end:
	Pop $2
	Pop $1
	Exch $0
FunctionEnd