Old 23rd May 2011, 15:27   #1
kraucer
Junior Member
 
Join Date: May 2011
Posts: 9
Red face Changing directory to call an executable?

I need to change the path at runtime. It would be the same command as the "change directory" cd. How can I do this in NSIS?

!define OCS_INSTALL_FILE "C:\ocs\install\ocs_setup.exe"
!define OCS_INSTALL_OPTIONS "/S /NP /NO_SYSTRAY /NOSPLASH /NO_SERVICE"
!define OCS_SERVER "http://myserver.com/ocsinventory"

ExecWait "'${OCS_INSTALL_FILE} ${OCS_INSTALL_OPTIONS} /SERVER=${OCS_SERVER}'"

The command "ExecWait" not working if called with the provided path. It only works if I call the direct path but for that I need to change the path.

ExecWait "ocs_setup.exe" is fine.
kraucer is offline   Reply With Quote
Old 23rd May 2011, 15:37   #2
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
SetOutPath C:\ocs\install
demiller9 is offline   Reply With Quote
Old 23rd May 2011, 16:06   #3
kraucer
Junior Member
 
Join Date: May 2011
Posts: 9
No, the problem is not just this. The problem is that "ocs_setup.exe" can only be executed if he is in the same way my NSIS installer.

An example: if I save my instalador_nsis.exe and ocs_setup.exe in the directory.
c:\ocs\ocs_setup.exe
c:\ocs\my_install.exe

The way it works above. If the way down, does not work:

c:\ocs\install\ocs_setup.exe
c:\ocs\my_install.exe
kraucer is offline   Reply With Quote
Old 23rd May 2011, 16:35   #4
kraucer
Junior Member
 
Join Date: May 2011
Posts: 9
Resolved, added 'at the beginning and end of the path variable in ExecWait. Thank you for your attention.
kraucer is offline   Reply With Quote
Old 24th May 2011, 09:05   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You should never use relative paths. If you do need a path relative to the running installer, use $EXEDIR\.... And yes, you need quotes (the manual clearly states this). They should be double quotes too, so '"[path]"'.

Stu
Afrow UK is offline   Reply With Quote
Old 24th May 2011, 17:31   #6
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
I don't think you need double quotes for any NSIS command. ' or ` work fine too.
MSG is offline   Reply With Quote
Old 24th May 2011, 17:44   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Quote:
Originally Posted by MSG View Post
I don't think you need double quotes for any NSIS command. ' or ` work fine too.
We're talking about the executable path for ExecWait (you need double quotes around it).

Stu
Afrow UK is offline   Reply With Quote
Old 24th May 2011, 20:07   #8
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Oh I see, the manual does show
ExecWait '"$INSTDIR\someprogram.exe"'
as the example. Guess it's the same as what Anders and I discussed about putting the ARP uninstall path between quotes. I'll add it to my checklist. :P
MSG is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
change, directory

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump