Copy file before include it in the installer package NSIS - file

For example I have a config file in D:\Project\InstallerPro\Platform\Windows8\Web.config
I need to move that file to D:\Project\InstallerPro\Web\Configuration\Web.config if the windows version is windows 8
After that, the installer will be generated from a nsi script in D:\Project\InstallerPro\PROinst.nsi
Is it possible to copy the files (not manually) before compiling it into an installer using NSIS?
I want to do something like this:
CopyFiles ".\Source\Platform\Windows8\Web.config" ".\Source\WEB\Configuration\Web.config"

CopyFiles is a runtime command, i.e a command that will run during the installer execution and not during the installer creation.
You could use the !system command that is executed during the compilation of the installer, e.g.:
!system `copy "c:\Source\Platform\Windows8\Web.config" "c:\Source\WEB\Configuration\Web.config"`
You will need to use absolute paths as the current working dir is from makensis.exe and not from the script being compiled.

Related

'ls' is not recognized as an internal or external command, operable program or batch file

'ls' is not recognized as an internal or external command, operable program or batch file.
I get this error when I try to glance at the files of my folder.
cmd opened regularly(not as an admin).
I've recently downloaded anaconda for python.During the installation process, there was a time when I allowed to add a PATH which was not recommended.
'ls' used to work well be
Here are the paths
I'm fairly certain that the ls command is for Linux, not Windows (I'm assuming you're using Windows as you referred to cmd, which is the command line for the Windows OS).
You should use dir instead, which is the Windows equivalent of ls.
Edit (since this post seems to be getting so many views :) ):
You can't use ls on cmd as it's not shipped with Windows, but you can use it on other terminal programs (such as GitBash). Note, ls might work on some FTP servers if the servers are linux based and the FTP is being used from cmd.
dir on Windows is similar to ls. To find out the various options available, just do dir/?.
If you really want to use ls, you could install 3rd party tools to allow you to run unix commands on Windows. Such a program is Microsoft Windows Subsystem for Linux (link to docs).
We can use ls and many other Linux commands in Windows cmd. Just follow these steps.
Steps:
1) Install Git in your computer - https://git-scm.com/downloads.
2) After installing Git, go to the folder in which Git is installed.
Mostly it will be in C drive and then Program Files Folder.
3) In Program Files folder, you will find the folder named Git, find the bin folder
which is inside usr folder in the Git folder.
In my case, the location for bin folder was - C:\Program Files\Git\usr\bin
4) Add this location (C:\Program Files\Git\usr\bin) in path variable, in system
environment variables.
5) You are done. Restart cmd and try to run ls and other Linux commands.
you can use dir instead of ls in cmd
If you want to use Unix shell commands on Windows, you can use Windows Powershell, which includes both Windows and Unix commands as aliases. You can find more info on it in the documentation.
PowerShell supports aliases to refer to commands by alternate names.
Aliasing allows users with experience in other shells to use common
command names that they already know for similar operations in
PowerShell.
The PowerShell equivalents may not produce identical results. However,
the results are close enough that users can do work without knowing
the PowerShell command name.
when you use windows as operating system you should write dir
and you will find all folders including empty folders and their data bytes storage
and you can use git ls-files to show all folders but not including hidden folders
The reason you cannot run the ls command is because it does not exist on windows. The windows equivalent is the dir command, however it does not work the same way. The solution, Winls. It is
The ls command, written for windows.
According the the Winls github.
Had this error because i was using command prompt to access my files.
how did i solve it...
i opened my folder with vscode, and used bash from the terminal...the "ls" command worked as it should from bash.

How to keep any program on Windows Startup with batch command

I want to run batch file on windows startup working with Windows 7, Windows 8 or Windows 8.1 which will start automatically on Windows Startup from any location of PC so that whenever PC start it will run automatically. Is there have any way to do that ?
you can use the task scheduler for that,
Action: Start a program
Program/script: path to your batch file : "c:\my\batch.bat"
Add arguments (optional): add here start parameters
Start in parameter (optional): Fullpath of your bat file location (needed if librarys are attached)
alternatively there is C:\Windows\System32\gpedit.msc
There you can easily navigate to adminstrative templates --> logon and add your script
A third method (and possibly the easiest) is to copy your files into the GP machine scripts startup folder.
C:\Windows\System32\GroupPolicy\Machine\Scripts\Startup
C:\Windows\System32\GroupPolicy\Machine\Scripts\Shutdown
Also works from the $OEM$ folder in case any readers are doing fresh installations.

Windows package installer for automatic setup

All,
I have a package that should be easily deployed on any client machine, say provided there is Windows as an OS.
Package contains icons, .dll, doc files, .xml templates, .py scripts...
I would like that the User unzip this folder anywhere, launch a .bat or any other script, and that package is copied pasted at the right place.
In a second phase, i could refine this installer deplacing some files at the right place.
Is it possible with a .bat file ? What would it look like ?
Thanks in advance.
Type in Start - Run
iexpress
and follow the prompts in the IExpress 2.0 Setup Wizard.

How do i combine a bat file with an MSI?

I have an MSI Installer that I created in WIX that i would like to be run from a .bat file, but I need it to be in one MSI file. How would i do that? for example i have a .bat file that does this
MD C:\TEMP\BATS
START /W msiexec /i Installer.msi /l*v C:\TEMP\BATS\INSTALLERLOG.txt
SLEEP 5
DEL C:\TEMP\INSTALLERLOG.txt
RD C:\TEMP
I want to create an .msi or .exe file that contains both the .bat file and the .msi file and will unpackage the two files and run the .bat file. Is this possible? I am doing it just to force Logging that will be displayed to the user through a custom action if the installer fails some how.
It sounds like you are caught by the technical details of the counterparts of your solution. Try to forget what you have for a moment and think of what you actually need.
As far as I can tell from your code snippet, the bat file creates a temporary directory, runs MSI package installation with verbose logging option, and then deletes the generated log file... Sounds a bit of no sense to me...
This is whatI would do in your case:
Get rid of that bat file
Ask yourself what its purpose is. If it is there to modify the target system, then revise this logic and move it to your MSI package following all the best practices you can find. If it has to to some service work, e.g. prepare parameters for the main MSI package, then consider authoring a bootstrapper.
You can try IExpress to generate a single EXE file. Another solution would be to use a self-extracting EXE archive which can launch a specific file when it finishes extracting.

inno setup - batch change InstallDircation

I am trying to run a batch file right before the installation begins,
Just after the user chooses the component he wants to install.
fortunately, I don't build it from basic, I have a ready iss file which depending on the component runs a batch file that you have created already.
In the batch file I trying to change the directory of the installer to specific one.
I tried to do so as I set INSTALLBINDIR and appfolder to my directory but it haven't work.
Do you know the variables I need to set so the installer will install where I want?
Edit:
I found out that I don't need to use a batch file.
To fixed a position to file you just need to put your Directory in the DestDir in [files]
You can't change the install directory directly from a sub script/program run from the installer.
You will need to set the WizardForm.DirEdit.Text in [Code] to the new value.
Alternatively, you can use a {code:...} constant for the DefaultDirName directive to get a suitable value to start with.

Resources