WIX - How to add command arguments to a File - command-line

I have made a WIX installer and i would like my main application .exe file to run using a command-line argument. I have the following line:
<File Id="MyApplicationExe.exe" Source="$(var.SourceFilesPath)MyApplicationExe.exe" KeyPath="yes" Checksum="yes"/>
For the tag File i cannot find any attribute named Arguments or Command.
Does anyone know if it is even possible to add a command to a File in WIX?

The fragment you posted basically just means, that the "MyApplicationExe.exe" should be copied to the target system when your install setup is installed. It says nothing on how to start your app.
If you want a shortcut (in start menu) which starts you application with a specific command line, then you can just create one.
Check out the manual on creating shortcuts:
How To: Create a Shortcut in the Start Menu
To specify command line arguments, use "Arguments" attribute of the "Shortcut" element.

Related

Run specific file always vscode-code-runner

Is there any setting for vscode-code-runner to setup a file that would be always run when I click on run button regardless which file is open in editor currently.
as of writing this comment i do not believe it's possible with this extension. The next best thing i can recommend is to execute the file you want to run with coderunner, then copy the command that it generated and executed. You can then paste this command in your setting.json file as a custom command like so
{
"code-runner.customCommand": "<created command>",
}
To execute the custom command from anywhere in your workspace, do ctrl+alt+K
You can also create a launch.settings file to run and debug your code from the debug tab which you can then execute with ctrl+shift+D
it's not as slick as a nice run button but it's better than nothing

How to start "Windows Terminal" via command line?

I am using Listary (which is a comfortable explorer integration) and I want to be able to start an instance of "Windows Terminal" in the current directory. My Listary command is configured, so that it starts the application under the path
C:\Users\%user%\AppData\Local\Microsoft\WindowsApps\wt.exe.
Unfortunately I couldn't find out yet a way to pass a target directory to Windows Terminal as a parameter. It refuses to take any paths and always starts at the %userprofile% directory. Is there a way to accomplish this behaviour?
I have found the solution, after reading this article:
https://devblogs.microsoft.com/commandline/windows-terminal-preview-v0-9-release/
In short, you have just to type "-d ." into the "Parameter" field of Listary's custom command. "." refers to the current directory.

How to know some app's console command in unity dash?

Is it possible to see some app's console command from unity dash menu?
For example, I open the Dash via the windows key, type in some app name, it appears in the list below, and I do "something" to see how to start it from the command line.
I am asking this because I came across multiple 3rd party apps whose console command has nothing with the app name, and I was unable to figure out how to open such apps from the console.
Navigate to this path in a file manager: /usr/share/applications
For example, with Nautilus you would run (in a terminal)
nautilus /usr/share/applications
Locate your program by name (using search if required).
Right click the file for your program.
Select 'Properties'.
There should be a 'Command' field which shows the command to be executed. If the program has arguments such as %U, those are file arguments passed when that program is used to open a file.

Launch mac eclipse with environment variables set

My company provides an eclipse based development environment which needs some environment variables setting up for the underlying toolchain so multiple versions can be installed concurrently and not take over the system.
I want to provide an icon in finder or the dock which sets these then launches eclipse so customers cannot accidentally launch eclipse without the environment being set. This is what I have tried so far:
Setting environment in Info.plist
for eclipse:
This should be a nice way to do it
but I cannot make it add to the
existing path (like export
PATH=/myapp/bin:$PATH).
bash script wrapping eclipse:
I created a bash script called
eclipse.command to set the
environment then launch eclipse.
This opens a terminal window as well
as the eclipse icon and allows
people to "Keep on dock" for the
bare eclipse. I cannot put
eclipse.command on the dock as it is
not an application.
Applescript wrapping eclipse.command:
An Applescript wrapper around
eclipse.command makes it look like
an app and prevents the terminal
window appearing. Unfortunately I
now get a dock icon for the
applescript and one for eclipse so
can still keep the bare eclipse on
the dock.
Any suggestions? Am I going about this in completely the wrong way?
There is an alternate solution which involves replacing the executable that is run by MacOS X when the user launches the Eclipse application with a shell wrapper that sets up the environment.
Create an empty text file called "eclipse.sh" in the Eclipse application bundle directory /Applications/eclipse/Eclipse.app/Contents/MacOS.
Open the eclipse.sh in a text editor an enter the following contents:
#!/bin/sh
export ENV_VAR1=value
export ENV_VAR2=value
logger "`dirname \"$0\"`/eclipse"
exec "`dirname \"$0\"`/eclipse" $#
In the example ENV_VAR1 and ENV_VAR2 are the environment variables being set up. These variables will be visible to processes launched from within Eclipse. The logger command will just log the path of the eclipse executable to the system.log as a debugging aid.
In the Terminal set the executable flag of the shell script eclipse.sh, i.e.:
chmod +x /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.sh
Open the Eclipse.app Info.plist and change the value for the key CFBundleExecutable from eclipse to eclipse.sh.
MacOS X does not automatically detect that the Eclipse.app's Info.plist has changed. Therefore you need to force update the LaunchService database in the Terminal by using the lsregister command:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/eclipse/Eclipse.app
The next time you launch Eclipse.app from the Dock or from the Finder the environment variables should be set.
I created the following:
alias start-eclipse='open /Applications/eclipse/Eclipse.app'
If you run start-eclipse from the command line, all env vars will be picked up. This way, you only need to maintain a single set of env vars across both command-line and eclipse environments.
Take a look at a related question: Environment variables in Mac OS X.
Basically, this involves the creation of a ~/.MacOSX/environment.plist file.
Log out and Log in for the environment.plist to get picked up by .App's
This worked perfectly in OS X Yosemite:
Open /Applications/Automator.
When the drop-down appears asking you what kind of document you want to create, choose "Application."
In the second-from-the-left list, double-click "Run Shell Script."
In the right side delete the "cat" that gets put there automatically, and replace it with this:
source ~/.bash_profile && /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
Now go to File->Save, and save the application to your Applications directory. I named it "Eclipse" with a capital 'E' so as not to conflict with the "eclipse" directory I already had. For good measure, you can even give it the Eclipse icon by selecting the real eclipse app, pressing command-i, selecting the icon, pressing command-c, then selecting the automator "Eclipse" app, pressing command-i, selecting the icon, and pressing command-v.
Now you can open the app, or even drag it to your dock. Note that if you start it, the "real" eclipse will still show up in your dock as a separate icon, but you can't have everything. :)
sakra's answer above is awesome, except is doesn't automatically inherit your existing bash environment. To ensure eclipse.sh picks up your existing bash environment, modify eclipse.sh to use bash instead of sh and add a line to source your existing ~/.bash_profile thus:
#!/bin/bash
source ~/.bash_profile
logger "`dirname \"$0\"`/eclipse"
exec "`dirname \"$0\"`/eclipse" $#
None of the above worked for me. you have to set Eclipse -> Preferences -> Terminal -> Arguments set to --login
That will instruct Eclipse to login with your account just after opening Terminal.
See screenshot:
Reference: https://marketplace.eclipse.org/comment/4259#comment-4259
Link to Eclipse doesn't use the path set in .bashrc
Create simple script
#!/bin/bash
source /home/user/.environment_variables
/home/user/eclipse_cpp/eclipse -Duser.name="My Name"
2.
Next put your all system variables in file /home/user/.environment_variables (any file you want)
My looks like:
export COCOS_ROOT=/home/user/Projects/edukoala
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
3.
Now you can delete your variables in .bashrc and put line
source /home/user/.environment_variables
Everything works fine :)
As pointed out in https://github.com/atom/atom/issues/7045, the environment variables can be loaded automatically, without explicit source ~/.bash_profile by using
#!/usr/bin/env bash -l
instead of
#!/bin/bash
source ~/.bash_profile
after that, in both cases, follows
exec "`dirname \"$0\"`/eclipse" $#
It works great for me, thanks for all previous work.
After setting env variables in .bash_profile.
Simply open the application through terminal!
open /Application/{path/to/app}.app

Eclipse: Add Command-Line Args to an OS X .app Directory

Is it possible to add custom command-line arguments to an Eclipse .app folder? In my particular case, I'm working with ZendStudio. I'm assuming the base Eclipse release would behave the same way.
I've found what looks like two different places that could work, but neither yield any results:
ZendStudio.app\Contents\info.plist
ZendStudio.app\Contents\MacOS\ZendStudio.ini
Am I looking in the right place, or is this even possible?
If you mean that you want to start Eclipse with some command line arguments, there is no file where you can add those to be used as default. But you can make a small script that will start Eclipse with the arguments you want, something like:
/Applications/Eclipse.app/Context/MacOS/eclipse some command line arguments
and then add executable permissions to your script, through Terminal window:
chmod 755 your_file
you can just type "chmod 755 " on the terminal and then drag and drop the script file on the terminal window, it will type the file's full path onto it, press ENTER and that's it. You can double-click your script file and it will start up Eclipse with the command line arguments you typed.