Archive: 2 questions : first on nsExec with Xcopy, second on directory of the exe


2 questions : first on nsExec with Xcopy, second on directory of the exe
First question :
I have try to use the nsExec dll like below with an xcopy action, but no copy is made.

nsExec:Exec '"xcopy" c:\from\*.* c:\to\*.*'

So unfortunately, I was obliged to use ExecWait.

Second question :
I explain. The user have copied the install.exe somewhere. Then he start it. I would like to know where is this exe, because I need to use it at the next logon of the user. Is it possible to know from which directory the intall.exe was started.

Many thanks to all of us and specially for people who have developped NSIS and let it free to use. A great product. I will have more questions, but answers to these first ones will help me to finish a first version of my product.

Regards

Thierry


1) Dave, got time to look at this?

2) $EXEDIR.


Using an external application like xcopy is not such a good idea anyway. Why not use CopyFiles?


I use CopyFiles elsewhere. But Xcopy offer more parameters like /exclude:filetoexclude.lst or other switch. So Dave, if you have a solution do not hesitate to post it.

Many thanks for your answers.


Did you give the full path to xcopy? (I.e. "$SYSDIR\xcopy.exe")


I did not give the full path.
...
But now, I have done. And it does not solve the issue. No copy is made. If I execute the same command in a dos window or by ExecWait it works.

Any more ideas ?


Please attach a little example to demonstrate the problem.


An example.

; nsixcopy.nsi

; The name of the installer
Name "nsixcopy"

; The file to write
OutFile "nsixcopy.exe"

Section "" ;No components page, name is not important

;Just initiate the example
CreateDirectory "c:\from"
CopyFiles "$EXEDIR\nsixcopy.exe" "c:\from"

nsExec::ExecToStack 'cmd /c dir c:\from'
Pop $0
Pop $1
MessageBox MB_OK|MB_ICONINFORMATION "Dir c:\from $\nCode : $0$\nResult :$\n$1"

nsExec::ExecToStack '"$SYSDIR\xcopy.exe" "c:\from\*.*" "c:\to\*.*"'
Pop $0
Pop $1
MessageBox MB_OK|MB_ICONINFORMATION "$SYSDIR\xcopy.exe c:\from\*.* c:\to\*.*$\nCode : $0$\nResult :$\n$1"

nsExec::ExecToStack 'cmd /c dir c:\to'
Pop $0
Pop $1
MessageBox MB_OK|MB_ICONINFORMATION "Dir c:\to $\nCode : $0$\nResult :$\n$1"

SectionEnd


Fixed in latest CVS version. nsExec didn't create a valid input handle which apparently bothered xcopy.


Thanks. Could you tell me when the release will be available ?

Moreover, I have other questions concerning nsExec. It seems that if does not accept pipe or redirection of the output like :

nsExec::Exec 'echo toto > toto.txt'

or

nsExec::Exec 'echo toto | sed s/o/a/'

Is it normal ?


To get it:

http://nsis.sourceforge.net/development

As for redirection, you need to use cmd or command. You can get the path reading CMDSPEC. Search the forum, there are some threads about this topic. Search for `mysql'.


It seems that the .dll is older
(Sat Jan 31 19:54:45 2004 UTC (5 weeks, 5 days ago) by kichik) than your resolution at :
http://cvs.sourceforge.net/viewcvs.p...ins/nsExec.dll

Perhaps I search in the wrong place :-(


Well, I guess SourceForge's annoymous CVS service is still lagging 5 hours behind, sometimes even longer. Use the snapshot, it's updated a couple of times a day.

For now use the attachment.


Obviously it works. Great !!! Thank you !