- NSIS Discussion
- problem while running command line
Archive: problem while running command line
vengaboy
12th October 2011 17:57 UTC
problem while running command line
Hello every body, this is my first post here and i Hope that some body will help me
when i Run this command nothing happens:
;$0=1234567891234567
;$R0=C:\info.txt
;$1=theNewFile
nsExec::Exec '"X:\encrypting\Ncrypt.exe" "-SF" $0 "$R0" $1'
when I replace $R0 with it's value it works :
nsExec::Exec '"X:\encrypting\Ncrypt.exe" "-SF" $0 "C:\info.txt" $1'
thanks
LoRd_MuldeR
12th October 2011 18:42 UTC
Are you 100% sure the content of your $R0 is C:\info.txt and not "C:\info.txt"?
In the latter case you'd end up with nsExec::Exec '"X:\encrypting\Ncrypt.exe" "-SF" $0 ""C:\info.txt"" $1' ;)
I'd suggest to use DetailPrint to print out the complete string you are going to send to nsExec and verify...
vengaboy
12th October 2011 19:01 UTC
Yes I am sure, I tried MessageBox MB_OK $R0 and the result is C:\info.txt
when I use the same command in cmd it's working ,
the working one:
nsExec::Exec '"X:\encrypting\Ncrypt.exe" -SF $0 "C:\info.txt" $1' ; this is work
I need to use the $R0
nsExec::Exec '"X:\encrypting\Ncrypt.exe" -SF $0 "$R0" $1'
MessageBox MB_OK $R0 ; the result is C:\info.txt exactly the same;) but didn't work!
T.Slappy
13th October 2011 05:42 UTC
@vengaboy: re-read LoRd_MuldeR's post again.
Text on message box is C:\info.txt or "C:\info.txt"?
The quotes are important, because for nsExec they must be doubled!
vengaboy
13th October 2011 14:29 UTC
the problem not resolved
thanks T.Slappy and LoRd_MuldeR for your replay
the Text on message box is C:\info.txt
the small project in the attachments, please I need help
thanks
LoRd_MuldeR
13th October 2011 14:53 UTC
I think the problem is that you have a NewLine+CarriageReturn char at the end of the string in $9.
Try like:
Function OnClick
${NSD_GetText} $Text $0
${NSD_GetText} $Text1 $1
nsDialogs::SelectFolderDialog "select the folder" ""
Pop $4
ExecWait '"$SYSDIR\cmd.exe" /c "dir /on /b /s "$4" > "$TEMP\listoooo.txt""'
pop $5
;read from txt file
ClearErrors
FileOpen $7 $TEMP\listoooo.txt r
SetOutPath $EXEDIR
again:
FileRead $7 $9
IfErrors done
StrLen $3 "$9"
IntOp $3 $3 - 2
StrCpy $9 "$9" $3
MessageBox MB_OK `'"$EXEDIR\Ncrypt.exe" -SF $0 "$9" "$EXEDIR\$1"'`
nsExec::ExecToLog '"$EXEDIR\Ncrypt.exe" -SF $0 "$9" "$EXEDIR\$1"'
StrCpy $1 "$11"
goto again
done:
FileClose $7
FunctionEnd
vengaboy
13th October 2011 15:11 UTC
thanks
thanks alot LoRd_MuldeR it's working now.:up:
LoRd_MuldeR
13th October 2011 15:42 UTC
Still I think you should use FindFirst and FindNext to find the files.
The workaround with using the "dir" command of the command-line interpreter has problems with Unicode characters, as I have noticed in my quick test. FindFirst/FindNext however should be Unicode-safe, at least when using Unicode NSIS.
vengaboy
13th October 2011 16:56 UTC
Ok i'll try
I am using Unicode characters, I'll try to use FindFirst and FindNext .
thanks for your advice