I want to run the executable file, automatically when the installation is going on. So I used Exec and ExecWait but both are not working. Could some one help me in figuring out this??
It doesn't show any error, but doesn't the files to folder "c".
FYI : The executable file is working fine, I tested it and the executable file is placed in the same folder as this file, so it isn't giving any error information like "File open failed/no such file".
Section "deploy_0.zip"
SetOutPath "C:\Users\Niharika\Downloads\Desktop\Tryng\c"
;File sji.exe //If I am uncommenting this, it is jus copying this file to the folder "c" that's it.
ExecWait ' "C:\Users\Niharika\Downloads\Desktop\Tryng\sji.exe" '
WriteUninstaller "C:\Users\Niharika\Downloads\Desktop\Uninstall.exe"
SectionEnd
Executing an executable file
10 posts
Sure, command File sji.exe does nothing but extract "sji.exe" (to the current $OUTDIR).
Also command ExecWait '"C:\Users\Niharika\Downloads\Desktop\Tryng\sji.exe"' is highly prone to fail! Hardcoded path "C:\Users\Niharika\Downloads\Desktop" will not exist on user's computer with probability of 99.9% 😉
Try this:
Also command ExecWait '"C:\Users\Niharika\Downloads\Desktop\Tryng\sji.exe"' is highly prone to fail! Hardcoded path "C:\Users\Niharika\Downloads\Desktop" will not exist on user's computer with probability of 99.9% 😉
Try this:
This will extract "sij.exe" to a unique sub-folder (will be auto-generated) inside %TEMP% and run it from there. Will also be cleaned-up when the installer exits.InitPluginsDir
File "oname=$PLUGINSDIR\sji.exe" "sji.exe"
ExecWait '"$PLUGINSDIR\sji.exe"'
I tried the below code :
Section "deploy.zip"
InitPluginsDir
SetOutPath "C:\Users\Niharika\Downloads\Desktop\"
File "oname =${PLUGINSDIR}\sji.exe" "sji.exe"
ExecWait '"${PLUGINSDIR}\sji.exe"'
SectionEnd
But I get the following error :
File: "oname =${PLUGINSDIR}\sji.exe" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk\AnalyzingBasic (2).nsi" on line 27 -- aborting creation process
But I have sji.exe in the same folder where I have this script, so is it that the code is nt being copied to temp folder??
And one more question is what exactly does PLUGINSDIR mean? And the TEMP folder you mentioned does it exist or a virtual one??
Sorry for asking so many questions, but I am newbie for NSIS Script 🙁
Section "deploy.zip"
InitPluginsDir
SetOutPath "C:\Users\Niharika\Downloads\Desktop\"
File "oname =${PLUGINSDIR}\sji.exe" "sji.exe"
ExecWait '"${PLUGINSDIR}\sji.exe"'
SectionEnd
But I get the following error :
File: "oname =${PLUGINSDIR}\sji.exe" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk\AnalyzingBasic (2).nsi" on line 27 -- aborting creation process
But I have sji.exe in the same folder where I have this script, so is it that the code is nt being copied to temp folder??
And one more question is what exactly does PLUGINSDIR mean? And the TEMP folder you mentioned does it exist or a virtual one??
Sorry for asking so many questions, but I am newbie for NSIS Script 🙁
Originally Posted by Niharika1588 View PostI tried the below code :
Section "deploy.zip"
InitPluginsDir
SetOutPath "C:\Users\Niharika\Downloads\Desktop\"
File "oname =${PLUGINSDIR}\sji.exe" "sji.exe"
ExecWait '"${PLUGINSDIR}\sji.exe"'
SectionEnd
But I get the following error :
File: "oname =${PLUGINSDIR}\sji.exe" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk\AnalyzingBasic (2).nsi" on line 27 -- aborting creation process
But I have sji.exe in the same folder where I have this script, so is it that the code is nt being copied to temp folder??
And one more question is what exactly does PLUGINSDIR mean? And the TEMP folder you mentioned does it exist or a virtual one??
Sorry for asking so many questions, but I am newbie for NSIS Script 🙁
File: "oname =${PLUGINSDIR}\sji.exe" should be:put sji.exe in same folder as scriptInitPluginsDir
File /oname=$PLUGINSDIR\sji.exe "sji.exe"
ExecWait $PLUGINSDIR\sji.exe
when you call it.. NSIS will copy sji.exe to TEMP dir (Trash directory)
and execute.. then clean up as Mulder said.
$PLUGINSDIR is an internal variable.. so you don't have to define it.
if you wanted to copy sji.exe to desktop..
InitPluginsDir
File /oname=$PLUGINSDIR\sji.exe "sji.exe"
CopyFiles /Silent `$PLUGINSDIR\sji.exe` `$DESKTOP`
Oups, forgot the /oname in my example 😐Originally Posted by PoRtAbLe_StEaLtH View Post[PHP]should be:
InitPluginsDir
File /oname=$PLUGINSDIR\sji.exe "sji.exe"
ExecWait $PLUGINSDIR\sji.exe
In that case, however, it would be more convenient to extract it to Desktop right away:Originally Posted by PoRtAbLe_StEaLtH View Postif you wanted to copy sji.exe to desktop..
InitPluginsDir
File /oname=$PLUGINSDIR\sji.exe "sji.exe"
CopyFiles /Silent `$PLUGINSDIR\sji.exe` `$DESKTOP`
Or:File "/oname=$DESKTOP\sji.exe" "sji.exe"
SetOutPath "$DESKTOP"
File "sji.exe"
Thank you for the replies both of you.
I tried with /oname also earlier, but didn't work.
Now why do I need to use the copyFiles option, I don't want to just copy the executable files.
The need the executable file to be executed automatically, because it's like nested executable files.
The below command is working :
ZipDLL::extractall "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk\client_9_6_0_0.zip" "C:\Users\Niharika\Downloads\Desktop\Tryng\c"
Here we are passing the zip file and using this command it is extracting the zip files to "C:\Users\Niharika\Downloads\Desktop\Tryng\c" folder which is what I want exactly.
Previously, what I had done is sji.exe will have all the files in the zip, once extracted it should copy to the folder.
Thanks a lot guys for the help.
I tried with /oname also earlier, but didn't work.
Now why do I need to use the copyFiles option, I don't want to just copy the executable files.
The need the executable file to be executed automatically, because it's like nested executable files.
The below command is working :
ZipDLL::extractall "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk\client_9_6_0_0.zip" "C:\Users\Niharika\Downloads\Desktop\Tryng\c"
Here we are passing the zip file and using this command it is extracting the zip files to "C:\Users\Niharika\Downloads\Desktop\Tryng\c" folder which is what I want exactly.
Previously, what I had done is sji.exe will have all the files in the zip, once extracted it should copy to the folder.
Thanks a lot guys for the help.
What exactly did not work?Originally Posted by Niharika1588 View PostThank you for the replies both of you.
I tried with /oname also earlier, but didn't work.
You do NOT need CopyFiles, if you just want to extract (and run) files!Originally Posted by Niharika1588 View PostNow why do I need to use the copyFiles option, I don't want to just copy the executable files
Then do it as suggested before!Originally Posted by Niharika1588 View PostThe need the executable file to be executed automatically, because it's like nested executable files.
Be aware: If the NestedInstaller.exe installer actually extracts+runs yet another EXE file, the ExecWait would wait for the NestedInstaller.exe but not for the child process that NestedInstaller.exe has created.InitPluginsDir
File "/oname=$PLUGINSDIR\NestedInstaller.exe" "NestedInstaller.exe"
ExecWait '"$PLUGINSDIR\NestedInstaller.exe"'
So do I get this right? You now package a ZIP file in your NSIS installer? If so, you would have to (1) make your installer extract the ZIP file and (2) extract the actual files from the previously extracted ZIP file using ZipDLL.Originally Posted by Niharika1588 View PostThe below command is working :
ZipDLL::extractall "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk\client_9_6_0_0.zip" "C:\Users\Niharika\Downloads\Desktop\Tryng\c"
Here we are passing the zip file and using this command it is extracting the zip files to "C:\Users\Niharika\Downloads\Desktop\Tryng\c" folder which is what I want exactly.
Previously, what I had done is sji.exe will have all the files in the zip, once extracted it should copy to the folder.
Thanks a lot guys for the help.
BUT: Is there really a good reason why you package a ZIP file (it means you actually have two layers of compression!) instead of just packing the "client" files in your NSIS installer ???
You can do:
This code assumes that the "client" files are located in the sub-folder "client" within the folder where your .nsi file located when the installer is built. With that code there will be no ZIP file needed.;Set path where to extract the "client" files
SetOutPath "$DESKTOP\Client"
;Now extract those files
File /r "client\*.*"
Also: Get rid of those hardcoded paths like "C:\Users\Niharika\Downloads\Desktop\Tryng\wrk" from your installer! On the users computer "C:\Users\Niharika" won't exist and your installer will fail horribly !!!
The reason why I package a ZIP file in the installer is due to the flow of work in our organization. To be precise that's what exactly my boss wants me to do.
I couldn't modify it, since it's how the flow works.
Thanks for the information. It helped me a lot, but I have one more question.
For eg, if I want to copy a file I use :
File Client_9.zip.
What if the user wants to enter the Client_9.zip as an input, from some textbox that we provide to the user??
Is there a way to provide how we can implement this??
I couldn't modify it, since it's how the flow works.
Thanks for the information. It helped me a lot, but I have one more question.
For eg, if I want to copy a file I use :
File Client_9.zip.
What if the user wants to enter the Client_9.zip as an input, from some textbox that we provide to the user??
Is there a way to provide how we can implement this??
You can extract the ZIP file right at the moment when your installer is being built and then only include the files extracted from the ZIP file.Originally Posted by Niharika1588 View PostThe reason why I package a ZIP file in the installer is due to the flow of work in our organization. To be precise that's what exactly my boss wants me to do.
I couldn't modify it, since it's how the flow works.
This could even be automated using the !system built-time command...
This does not "copy" anything! It extracts the file "Client_9.zip", from the installer, into the current $OUTDIR. And it's also what causes the file "Client_9.zip" to be included in your installer.Originally Posted by Niharika1588 View PostThanks for the information. It helped me a lot, but I have one more question.
For eg, if I want to copy a file I use :
File Client_9.zip.
What exactly is the user supposed to provide from a text box ??? 😕Originally Posted by Niharika1588 View PostWhat if the user wants to enter the Client_9.zip as an input, from some textbox that we provide to the user??
Is there a way to provide how we can implement this??
(1) Target path of the directory to where "Client_9.zip" shall be extracted?
(2) File name to which "Client_9.zip" shall be extracted, in current $OUTDIR?
(3) Source path from where the file "Client_9.zip" shall be copied to somewhere else?
(4) Something else?
Sorry for the inappropriate questions.
I thought about it later and came to know that it isn't possible. I missed the most silly think that to extract the file it must be present in the executable file and adding all the files increases its size.
Anyhave, glad to meet you. Thanks for the help!!
Have a great day!!
I thought about it later and came to know that it isn't possible. I missed the most silly think that to extract the file it must be present in the executable file and adding all the files increases its size.
Anyhave, glad to meet you. Thanks for the help!!
Have a great day!!