running a command line application outside of its folder (windows) - windows

I've done this once before and have forgotton.
I need to run for example
c:/myfolder/anotherfolder/app.bat
from anywere i.e
c:/app.bat or c:/genericfolder/app.bat or c:/thisfolder/app
is it setting environment variables?

The easiest way is to add the location of the app to your "PATH" environment variable.

Related

Setting default path with custom variable in windows 10pro

I have been trying to get windows to recognize shortcuts for developer tools. Things like adb for C:\Users\myusername\Andriod\platform-tools\adb.exe. I have tried using CMD and Powershell but they both don't add the PATH I tried the GUI and it doesn't show up.
I've tried setx path "%PATH%;C:\path\to\C:\Users\myusername\Andriod\platform-tools\adb.exe" in powershell and cmd then restarted powershell or cmd
input the variable adb but it pulls a command not recognized error.
Did you try the following?
Adding the path "C:\Users\myusername\Andriod\platform-tools" to your system/user PATH variable? You can do this by start-> environment variable -> environment variable and under system or user, edit the PATH variable and add the above link. Once you do this, restart CMD for it to work.
Add the executable in one of the already existing locations that are in the PATH variable. (Although this is one method, I would not suggest this). Again, if the executable has any dependencies, it must be in a place where the exe itself can access.

Jmeter 4.0 While opening jmeter.bat from command line showing exception JMETER_HOME environment variable is not defined correctly

C:\apache-jmeter-4.0\bin>jmeter.bat
The JMETER_HOME environment variable is not defined correctly
This environment variable is needed to run this program
JMETER_HOME is set correctly in environment variable.
ApacheJMeter.jar is working fine.
Similar issue found in below link but this also not helping me.
JMETER_HOME environment variable is not defined
You don't need to set JMETER_HOME variable manually, jmeter.bat script should detect it automatically.
Just in case you want to override it for any reason make sure you do this carefully and the variable points to your JMeter installation like:
set JMETER_HOME=C:\apache-jmeter-4.0 pushd %JMETER_HOME% && jmeter.bat
It might also be the case that Windows doesn't have necessary permissions assuming JMeter lives in root of system drive, try running command prompt as Administrator
More information:
Running JMeter
How to Get Started With JMeter: Part 1 - Installation & Test Plans
You don't need to set JMETER_HOME path explicitly under user variables, just add/change under system variables under path variable as your bin path. If you already have earlier version of JMeter just append with latest version. Path looks like : C:\XXX\apache-jmeter-4.0\bin

Setting environment changes?

I would like to ask you if it's normal that my "Setting environment" changes after each system reboot or even if I just close my cmd console.
for example, I'm using python 3.5, when I wan to use python or to uses pip under the cmd I got an error like :
C:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.
To fix this, I use :
set PATH=%PATH%;C:\Python35
It works after, but as I said before, once I restart my computer, or I close the console, I've the same problem !!!
Thanks in advance for your help and comments. I just would like to inform you that I'm using Windows 7 - 64bits.
You need to add this path in System (Windows+Pause key), Advanced, Environment variables. There you have two sections, System and User, in System, edit the PATH key.
The next time you start a console the path will be present.
Alternaly, if you don't want to modify the setting there (or you have no rights) you could start the app with a batch file which sets the path before launching the app.
In Ruby you can adapt the environment variables from within the script itself by using ENV eg ENV['path'] += 'C:\\Python35'
, I'm sure Python can do this too but wouldn't know how. In your use case this won't help of course.
The SETX command will set the variable permanently. Use SETX /? for information. Set a persistent environment variable from cmd.exe
For Python, many developers use venv which is included with the Python install. https://docs.python.org/3/library/venv.html?highlight=venv#module-venv

Reading environmental variables in PowerShell or cmd yield different results

I have been puzzling over an issue with environmental variables in Windows 7.
We have a Jenkins server which cannot find the SSH keys in the %HOME% environmental variable as it wants to access the path:
/c/users/jenkins
However if I use
echo %HOME%
in a normal command prompt window as my Jenkins user then the result is
C:\users\jenkins
However, if I use the environment command in Windows PowerShell I also get
/c/user/jenkins
In the normal GUI accessible from the system properties - advanced tag -> environmental I get the following
C:\users\jenkins
I have tried setting them back, but the issue persists. In so far as Jenkins gets the same output as PowerShell.
How do I set them back? (Not that cmd and the Windows system think that they are set wrong.)
How on earth does accessing the same environmental variable give me different outputs?
Is there a way in which this can occur?
Where are they stored so I can manually edit where they are stored?
As mentioned in a comment by #Luis, the env command is not part of PowerShell. It is likely provided by some other set of utilities that you have installed and is intended to emulate the Linux env command.
To refer to an environment variable in PowerShell, use the $env:<variable-name> syntax or the environment provider - Get-Content env:\<variable-name>.
To set an environment variable, you can use $env:<variable-name> = "<variable-value>"
For more information, try running help about_Environment_Variables in PowerShell.

Tomcat environment variable wrong value

I am facing this problem :
the CATLALINA_HOME environment variable contains this value:
"?C:\Tomcat" instead of "C:\Tomcat".
I don't know where this "?" comes from.
I am working on Windows.
thanks
Usually that variable comes from catalina.sh or catalina.bat look for this files in your Tomcat/bibn folder.
If you're working on Windows just open the file .bat: catalina.bat

Resources