I am trying to add a path, in PATH variable. I run cmd.exe as administrator and used
setx PATH "%PATH%;C:\MinGW\bin"
setx PATH "%PATH%;C:\MinGW\msys\1.0\bin"
I then restarted my computer, but if I type path I don't see the paths that I set there. Note that with the exact same way I was able to set some other directories on PATH.
Any idea on what might be wrong?
you should use
"My Computer" > "Properties" > "Advanced" > "Environment Variables" > "Path".
setx PATH "%PATH%;C:\MinGW\bin"
setx PATH "%PATH%;C:\MinGW\msys\1.0\bin"
Should first set PATH to "%PATH%;C:\MinGW\bin" and then to "%PATH%;C:\MinGW\msys\1.0\bin", so the second setx overrides the first because setx does not set the variable in the current or existing CMD sessions - only new ones.
setx PATH "%PATH%;C:\MinGW\bin;C:\MinGW\msys\1.0\bin"
theoretically should set PATH with those two directories appended - for future sessions.
You can check by simply starting a new session and executing a
path
command.
If the change doesn't survive a reboot, then some other process is resetting it.
If the change doesn't occur at all, then there's something mighty fishy going on. Possibly a typo...
I'd try setting some other variable as a test, say mypath.
You can delete a variable using
setx mypath ""
Googling for PATH EDITOR may be useful...
Related
i am trying to run my MSTest from the command line, and I cannot for the life of me figure out why this isn't working. Yes it works if I manually change the directory to the executable, but I don't want to do that every time.
In the image below, you can see I have set up the environment variable, and yes I have restarted my computer many times.
You need to add it to your PATH variable. In that same dialog edit the Path variable and add the folder to the path. For example, I have enterprise installed, so I used this path:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow
After updating the path you will need to close and restart the cmd window.
I am wanting to program Minecraft mods using forge. I am going through the standard installation to begin creating mods, but I have run into an issue. I ran the code "gradlew setupDecompWorkspace eclipse" and it is telling me "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_Home vairable in your environment to match the location of your Java installation." Is it possible to change something else or do something else that will allow me to program? I also cant change the environment variables.
You can change environment variables, even without being an administrator.
The easiest solution is to use set to temporarily change the environment variable for only your session (IE, it'll get reset when you close your command prompt):
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_91
gradlew setupDecompWorkspace eclipse
Obviously, you'd change the location given to a different one if you have the JDK in a different location.
If you want to change it more permanently, you can use the setx command. Setx keeps the changes you made between sessions (and, more importantly, you don't need to be an administrator, since changes are only made to your account). Note that running setx doesn't apply the changes to the current command prompt window, only future ones; you'd need to close and reopen command prompt after setting the path.
Run
setx JAVA_HOME "C:\Program Files\Java\jdk1.8.0_91"
and then close and reopen your command prompt, and it should keep the path set. (Note that again, you'd want to use the path for your java installation; also it needs to be surrounded by quotes here).
If you don't want to run set each time, you can probably edit gradlew.bat and put the same set command at the top of it.
Simply open gradlew.bat with a text editor and then put
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_91
at the top of it (again, replace the path with the correct one for your version).
I am a beginner in this. I just install Cygwin. I have problem in access all my environment variable.
e.g.
prior to install cygwin, i am using cmd prompt. I added a variable named "shotcut" with value "c:\my_doc\". In the c:\my_doc\, i create a shotcut.bat. The content is cd /dc:\my_doc.
Then, i added %shotcut% into a variable called "PATH". When i use cmd, once i type shotcut, it will move to c:\my_doc\
However, using cygwin terminal, i type shotcut and pops out command not found. What can i do in order to use all my environment variable.
Thanks
Cygwin imports environment variables, so if you have one called "shotcut" as you say, the equivalent var called $shotcut should exist in your Cygwin environment. Doing echo $shotcut should output the path you set in your OS.
Alternatively, you could run the env command, which will list the full set of vars currently set in your shell session, and look for your variable in there.
How can I modify the mercurial.ini file to include an environment variable such as %userprofile%.
Specific situation:
I am learning to use Mercurial. I have modified the [ui] section of Mercurial.ini (in my home path) to include:
ignore = c:\users\user\.hgignore
Where user is my username literal. The .hgignore file includes filename filters that are used to ignore files during commit. How can I alter it from being the a literal user to an environment variable $user?
It won't interpolate environment variables in the hgrc, but I do believe that tilda expands to your home/profile directory correctly even on windows.
So:
ignore = ~/.hgignore
should work on windows and elsewhere (even the slashes get spun the wrong way automatically for you).
For other variables you'd need to get a little tricker and write a batch/cmd file that does the interpolation in advance and then hands the result off to mercurial for processing.
The mercurial.ini parses the environment variables just fine.
From my mercurial.ini:
[ui]
ignore = %USERPROFILE%/.hgignore
Works like a charm. Windows 7 Ultimate x64, Mercurial 1.5 (binary installation). The hgignore file is honored both my the command line hg.exe, and tortoiseHG.
How do you register a name for a program in the windows run dialog?
For instance typing in "notepad" and pressing enter runs notpad.exe
"photoshop" in my case runs Photoshop CS3
I'm using vb2005.net
Besides the system path, there's also the App Paths in the registry. Visual Studio, for example, doesn't have its main app (devenv.exe) in the PATH, but you can still launch it from the Run dialog.
Available names are enumerated under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths, with corresponding launch paths as values under each name.
See http://www.tweakxp.com/article36684.aspx for an example of how to add an exe to your App Paths.
This works because those applications have added the directory containing their executable to Window's PATH variable. This variable is used to resolve the locations of any files entered into the run dialog (among other things).
Please see How to set the path in Windows 2000 / Windows XP.
There is no registration, your program .bat, .exe must be within the system path.
If you right-click on "My Computer" ->"Properties"-> "Advanced" then go to the "System Variable". You can edit the "Path" variable to include the location of your executable.
This has nothing to do with "registering" a program. Windows uses the current value of your PATH environment variable, and any executables found in those directories can be executed by simply typing the name into the Windows "Run" box (or command prompt, or anything else that launches executables).
Some programs add their directories to the PATH, others drop an executable (or even a batch file) into a well-known directory that is already part of the PATH, such as the Windows directory.
Add the program's path to your PATH variable.
If you want to do it programmaticly, you can edit (append, not just set) this registry location (in, say, your installer):
HLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path