I need to run a .bat file after .msi installation in Wix. I have created this .msi from Wix setup project.
In the .bat file, I have written scripts which edit the etc/hosts files and install some fonts into windows machine as per my application need.
Please help me to resolve my issue.
Thanks.
It's possible to run a .BAT but that's really to do things like set up a java classpath and launch a java application. Not to make additional changes to the machine.
There are several issues with your design.
1) The UI sequence shouldn't run with elevated permissions so the .BAT won't have rights to do the things you want to do
2) The changes are being made outside of the installation transaction so there's no support for rollback or uninstall
3) The changes are being made by a script that has no support for logging or error handling. It'll be fragile.
4) Because the changes aren't expressed in Windows Intaller tables you loose the expressiveness and transformability that MSI provides.
The .BAT should be refactored and likely eliminated. The "how do I xyz?" questions for each thing it does (install a font, modify a file...) should each be their own StackOverflow question.
<CustomAction Id="RunBatch"
Execute="deferred"
Return="ignore"
Impersonate="no"
ExeCommand=""[SystemFolder]cmd.exe" /C "[INSTALLDIR]mybatchfile.bat""
Directory="INSTALLDIR"/>
<InstallExecuteSequence>
<Custom Action="RunBatch" Before="InstallFinalize"/>
</InstallExecuteSequence>
Related
I am trying to figure out how to do so for a batch file that can be ran on startup of my PC.
You can use dotnet-build and dotnet-run commands.
dotnet-build: builds a project and all of its dependencies.
dotnet-run: provides a convenient option to run your application from the source code with one command.
For more information, refer these links-
dotnet-build and
dotnet-run.
All of the below on Windows 7 Machines and regarding Notepad++ installation / uninstallation:
Uninstaller
When I try to uninstall using the command
if exist "C:\Program Files (x86)\Notepad++\uninstall.exe" "C:\Program Files (x86)\Notepad++\uninstall.exe" /S
there are some files left in the Notepad++ file afterward. Notepad++'s uninstaller, when run manually, prompts halfway through the uninstall asking "Do you want to keep your custom settings" and I'm thinking that the command may be choosing to answer this "Yes" by default. I'm wondering if there's an easy way to have it choose "No" here instead. If not, I can probably just delete the folder.
Installer
I'm running the installation using the 32 bit default .exe file from Notepad++ in a deployment package compiled in Lansweeper. What I'm noticing is that presently, the package executed the CMD uninstall command, but stops short of installing the new version. For reference, I've been using an installed 7.3.2 and the installer for 7.3.3 to test, so that it should uninstall the 7.3.2 and install 7.3.3 by the end of the package.
I'm wondering if the fact that there are a number of options in the Notepad++ installer could be the culprit here. If it is better to install via command line or to include some sort of configuration file I'm fine with either option, just not especially well-versed in doing them.
Notepad++ Installer requests the following during installation:
Select a language - should choose English
Choose Components - want to be able to customize selection of localization / auto complete / themes / context menu / plugins / auto update according to our requirements
Choose Components - Don't use Appdata, Allow Plugins to be loaded from Appdata, and Create Shortcut on Desktop should all remain unchecked
Run Notepad ++ - should be unchecked (checked by default)
All the other components that I can see are straightforward Next / I Agree buttons.
I'm hoping someone may be able to make helpful suggestions here as I've not had any experience with configuring silent installs with specific parameters. Notepad++ doesn't seem to have its own MSI and I won't use a third party one so some sort of batch or configuration file or flagging options in cmd if possible are the preferable options.
Please let me know if there's any additional information I can provide that may be helpful.
Thank you in advance.
If you just need to update to the latest version. It is quite simple. Run the newest installer again and it will automatically update older versions.
See
Silent Install Notepad++
I'm using the command:
start /wait npp.7.2.Installer.x64.exe /S
Didn't show any interface during silent installation.
Notepad kicks a secondary process that doesn't finish until success is evaluated.
try:
"%ProgramFiles(x86)%\Notepad++\uninstall.exe" /S
timeout 5
I'd like to schedule a KNIME workflow. The workflow does its job very good as long as I start it from the KNIME GUI application. When I execute the same workflow via command line, java complains that com.microsoft.sqlserver.jdbc.SQLServerDriver
could not be found (ClassNotFoundException).
I invoke it via:
"D:\Progamme\KNIME\knime.exe" -nosplash -application -consoleLog org.knime.product.KNIME_BATCH_APPLICATION -preferences="absolutepathto\preferences.epf" -workflowDir="absolutepathto\workflow"
Since the error message signals missing content in the java CLASSPATH I also tried to add the parameters
-vmargs -classpath .;"absolutepathto/sqljdbc42.jar"
But still I earn a java slap, pointing to the same error...
I also tried to run the command from within the knime.exe's directory and I also tried to add the JAR file to Preferences -> Java -> Build Path -> Classpath Variable / User Libraries (referenced via the -preference argument). But that had no effect.
Did anybody face the same problems? Maybe with other third party JARs?
It is all about a Database connector that is configured like this:
Does the integrated security maybe force a misleading error?
System spec: KNIME 3.2.2 on Windows Server 2008 R2
Update - extract from preferences file
/configuration/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
/configuration/org.eclipse.ui.ide/MAX_RECENT_WORKSPACES=10
/configuration/org.eclipse.ui.ide/RECENT_WORKSPACES=<list of some workspaces>
/configuration/org.eclipse.ui.ide/RECENT_WORKSPACES_PROTOCOL=3
/configuration/org.eclipse.ui.ide/SHOW_RECENT_WORKSPACES=false
/configuration/org.eclipse.ui.ide/SHOW_WORKSPACE_SELECTION_DIALOG=true
Is there maybe a problem due to the fact that it is a shared KNIME instance among several users and the command line execution does not know which workspace has to be chosen? Is the workspace somehow needed and why?
Partial Solution:
I finally managed it but I don't know exactly why it works now. What I did was to load a fresh portable version of KNIME and ran the same commands only changing the executable path to the new portable version. Before that I started the portable version once to set the workspace directory and register the database driver in preferences dialog and .ini file, nothing else, same configuration so far as the shared KNIME instance. What I am really wondering abpout is that from now on the commands are also working with the shared KNIME instance. I really don't know what caused the change that let KNIME find the driver class.
Info
Because I encountered a few more problems within shared environment in KNIME command line mode, that led to undeterministic execution results, I wrote a little .NET library. This gives me more flexibility/control over the workflow execution (which returncodes and error messages occured and so on). You can find it here if you're interested: KnimeNet
I took a very minimal approach:
cd "C:\Program Files\KNIME"
.\knime -nosplash -noexit -consoleLog -reset -application org.knime.product.KNIME_BATCH_APPLICATION -workflowFile="D:\Work\Knime Workflows\Output\CMD_Test.knwf" -preferences="D:\Work\Knime Workflows\Output\CMD_Test.epf"
We create an installation .exe with burn that successfully installs .NET4 as a prerequisite and our .msi which was created with a wix script. All this works quite well.
Our wix script creates an uninstall shortcut (pretty much taken from the wix how-to pages):
<Shortcut Id="UninstallProduct"
Name="Uninstall Product Name"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Uninstalls Product" />
If I use this shortcut, the application is correctly uninstalled and all relevant files are removed. However, the entry in the installed programs table in "Programs and Feature" is still there. I also notice that it is not the burn UI that comes up if I use the uninstall shortcut. Basically, my question is: How can I create an uninstall shortcut that removes the entry in the Programs and Features table when using burn?
I have two MSI installers,BasicInstaller.msi and updateInstaller.msi.As name suggests,the updateInstaller.msi is a updated version(with some new files added) of basic installer.I have installed Basic installer in UI mode where i have mentioned the installation path as "D:/MSIApp".
I am installing the updateInstaller.msi in silent mode using msiexec.cmd(this goes into a bat file) that overwrites the files and registry entries created by BasicInstaller.msi. I am able to install it using the below command
msiexec /i updateInstaller.msi /qn TARGETDIR=D:/MSIApp
Now,i am looking for logic where in the installated path of basicInstaller is picked up and updateInstaller is installed at the same location.In short,i want to avoid TARGERDIR switch hard coding.
If i don't specify TARGETDIR in the msiexec,the updateInstaller is installed at the default "C:/programfiles/..." location.
Could some one help me with the possible solution options.Any help appreciated.
This is usually accomplished by having the installer lay down an InstallPath (or similarly named) registry entry. Subsequent installers can read the entry and use it as their installation path.
See this page for an example.