PATH environment variable is different in cmd and system properties [closed] - windows

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I'm having a problem with the PATH environment variable. If I look at the PATH in the environment variables in System Properties, I get this (added newlines for readability):
C:\app\User\product\11.2.0\dbhome_1\bin;C:\Python34\;C:\Python34\Scripts;
C:\Program Files\Common Files\Microsoft Shared\Windows Live;
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files (x86)\Windows Live\Shared;C:\Program Files(x86)\CMake\bin;
C:\Program Files\Microsoft\Web PlatformInstaller\;
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;
C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;
C:\Program Files (x86)\Livestreamer;C:\Program Files (x86)\Git\cmd;
C:\MinGW\bin;C:\Program Files (x86)\Skype\Phone\;
C:\Program Files\Haskell Platform\7.10.3\mingw\bin;
C:\Program Files\Microsoft Network Monitor 3\;
C:\Program Files\Java\jdk1.8.0_20\bin;C:\Users\User\Anaconda3;
C:\Users\User\Anaconda3\Scripts;C:\Users\User\Anaconda3\Library\bin;
C:\Users\User\Anaconda\Lib\site-packages;C:\gradle\bin
But if I open cmd with the Run dialog and write PATH, I get:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Haskell\bin;C:\Program
Files\Haskell Platform\7.10.3\lib\extralibs\bin;C:\Program Files\Haskell Platfo
rm\7.10.3\bin;C:\gurobi605\win64\bin;C:\Perl\site\bin;C:\Perl\bin;C:\app\User\pr
oduct\11.2.0\dbhome_1\bin;C:\Python34\;C:\Python34\Scripts;C:\Program Files\Comm
on Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Micro
soft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live
\Shared;C:\Program Files(x86)\CMake\bin;C:\Program Files\Microsoft\Web Platform
Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\P
rogram Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program File
s (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files (x86)\Microsoft SQL Serv
er\120\DTS\Binn\;C:\Program Files (x86)\Livestreamer;C:\Users\User\AppData\Roami
ng\npm;C:\Program Files (x86)\Git\cmd;C:\MinGW\bin;C:\Program Files\Microsoft SQ
L Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\1
10\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Fi
les (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files
(x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;
C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files\Haskell Platform\
7.10.3\mingw\bin;C:\Program Files\Microsoft Network Monitor 3\
Can I somehow make them the same? I need to use the PATH in the System Properties, not the one in the command line.
I tried changing the path in the command line using set PATH="(new path)", but that only changes it temporarily. It turns back if I close and open a new console window.
I also tried setx PATH "(new path)" but it doesn't change anything either.
I'm using Windows 7 Home Premium 64-bit

This is because the variable PATH has different scopes and thus can have different contents. These scopes are user and machine. setx sets user variables (HKEY_CURRENT_USER) but if you add the switch /m then these variables will be set system-wide (HKEY_LOCAL_MACHINE).
System Properties shows the user scoped variables contents, while echo %PATH% shows system-wide contents.
If you want to have the same contents in both permanently you can use PowerShell as described here.

There are two type of variables are in Windows. User variables and System variables. You can see and edit its. Open System Properties, open Advanced tab, click on Environment Variables button. Just added that do you need to the properly variables zone.

Related

After adding related directory into path, I still can't execute the command in other directories

So I have added the related directory into the path in my cmd context (not in the registry or environment variable). But the command is still not available for me in other directories. The following screen shot demonstrate what I mean:
I can also paste the related commands and results here:
C:>cd "Program Files"\sfdx\bin
C:\Program Files\sfdx\bin>path "%path%;%cd%"
C:\Program Files\sfdx\bin>path
PATH="C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program
Files
(x86)\nodejs\;C:\installed\ffmpeg-20160531-git-a1953d4-win64-static\bin;C:\Python27;C:\Python27\Scripts;C:\Program
Files (x86)\Skype\Phone\;C:\Program Files\dotnet\;C:\Program
Files\Git\cmd;C:\Users\Lance.shi\AppData\Local\Microsoft\WindowsApps;C:\Users\Lance.shi\AppData\Local\Programs\Git\cmd;C:\Program
Files\sfdx\bin"
C:\Program Files\sfdx\bin>pushd \Lance
C:\Lance>sfdx
'sfdx' is not recognized as an internal or external
command, operable program or batch file.
C:\Lance>popd
C:\Program Files\sfdx\bin>sfdx
Usage: sfdx COMMAND
Help topics, type sfdx help TOPIC for more details:
force tools for the Salesforce developer plugins manage plugins
update update CLI
C:\Program Files\sfdx\bin>
Any reason why this is happening?

Unable to remove cygwin from PATH environment variable

I recently had to reinstall Cygwin and in doing so, I have ran into a problem with some application because Cygwin seems to be appended to my PATH environment variable. I have tried to remove this by following these instructions https://www.java.com/en/download/help/path.xml but something strange happens. If I look at the value of Path under 'Environment Variables', Cygwin is not there; however if I type PATH in cmd.exe, I see Cygwin gets appended at the end of the PATH. Can you please help me to know to remove Cygwin from the PATH?
As an example, this is what I see in the Environmental Variables window Path value:
Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program
Files\Intel\iCLS
Client\;c:\Oracle\11g_R2_x64\Administrator\11.2.0\client_1\bin;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program
Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files
(x86)\Intel\Intel(R) Management Engine
Components\IPT;%systemroot%\System32\WindowsPowerShell\v1.0\;C:\Apps\Anaconda3;C:\Apps\Anaconda3\Scripts;C:\Apps\Anaconda3\Library\bin
And this is what I see in cdm.exe:
PATH PATH=C:\Program Files (x86)\Intel\iCLS
Client\;C:\Program Files\Intel\iCLS Clien
t\;c:\Oracle\11g_R2_x64\Administrator\11.2.0\client_1\bin;C:\ProgramData\Oracle\
Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS
\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:
\Program Files\Intel\Intel(R) Management Engine
Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine
Components\DAL;C:\Program Files\Intel\Int el(R) Management Engine
Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Man agement
Engine
Components\IPT;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\App
s\Anaconda3;C:\Apps\Anaconda3\Scripts;C:\Apps\Anaconda3\Library\bin;C:\blp\DAPI;
C:\blp\DAPI\DDE;C:\Apps\cygwin64\bin
As you can see, I have Cygwin in the second case, whereas I don't have it on the first case.
UPDATE:
Thanks to Patrick for his answer below. Just to complement, in Windows you should be able to edit both the user and system environment variables from the Control Panel as in this screenshot:
There are two PATH variables in Windows. Both are available on that page for environment variables. One is in the top pane (User variables) and the other is in the second pane (System variables). They are both called PATH, but they are separate and distinct entities. When you launch cmd.exe, the PATH variable you end up with is the result of combining those two variables. To fix the problem you are seeing here, return to the Environment Variables pane and check both versions (User and System). Based on your PATH variables above, I suspect the User PATH will contain the following three entries:
C:\blp\DAPI;
C:\blp\DAPI\DDE;
C:\Apps\cygwin64\bin
That's the only functional difference in your cmd.exe PATH and the other on after variables like SYSTEMROOT are expanded. You should be able to delete the Cygwin directory there.
My problem was different, but still led me here, so hopefully someone else might benefit from this.
In my case, C:\cygwin64\bin was NOT present in either the user variables PATH or the System variables PATH. However, whenever I ran python it was using the executable stored in C:\cygwin64\bin instead of the location I had python installed to.
(This was confirmed by running Get-Command python | Select-Object -ExpandProperty Definition in PowerShell).
It turned out my problem was that for whatever reason my System variables Path also contained C. Yes, just C. Removing this effectively removed C:\cygwin64\bin from my Path (and anything else the root C:\ directory).
So if you're having an issue like this where something that's NOT in your path is behaving as if it is, maybe check if that item's parent directory has been added.

Duplicates in windows environment path

For some reason I do not know, my echo %path% has many duplicates of C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\. As far as I know, long %path% is bad because it slows the searching process. Is it safe to remove these duplicates?
I also noticed that there are two version of path variable: one for user variables and one for system variables. If I type echo %path% in command prompt as normal user, it will show the concatenation of these two version (system version comes first). If I am to remove the duplicates, from which version should I remove?
(bold one is system version)
C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\MinGW\bin;C:\Python27;C:\Users\jie\AppData\Local\Microsoft\WindowsApps
On Microsoft Technet (Scriptcenter) there used to be a small PowerShellScript which checks against duplicate paths: How to check for duplicate paths in PATH environment variable
(It's gone now, at the original location, but archive.org has a copy.)
Should be run in a PowerShell environment with admin rights. I do this after every uninstall of any software (Windows 10 x64).
The paths you mention are system paths. They should stay in the PATH variable in the system scope. You can remove the duplicates in the PATH variable of the user scope, but you should reboot and check, if every application is still working (not because you deleted a duplicate, but to make sure you didn't delete something wrong by mistake). As usual, backup your PATH variables somewhere, before you start.
Duplicates inside each scope can always be safely removed. The list is split at every semicolon and each resulting path in the list is searched. If there are duplicates, the same search simply executes twice in the worst case. In the best case, the system might recognize the duplicates (I'm not sure if this happens), but this would mean additional effort for recognizing. So your statement on slowing down is correct in any case.
The reason for you duplicates (if it wasn't you at least) might probably be some application you installed somewhen, which edited the PATH variable improperly.
I was still wondering why some processes have a duplicate part in the PATH environment variable.
Some investigating, the problem occurs by processes started by explorer.exe. It does not occur for processes which were not initially a child process (or 'child process of child process') of explorer.exe.
I think, the user part of the Windows PATH environment variable is influencend by :
The two registry entries:
HKCU\Environment\Path
HKCU\Environment\1\Path
The process explorer.exe (which is runnng in the user context) loads both entries for the PATH environment variable.
I deleted for the test HKCU\Environment\Path when HKCU\Environment\1\Path exists. The duplicate part of the PATH environment variable no longer exists.
Deleting or modifying this registry key should be done very carefully. Probably you ran in other unexpected problems, because the Windows Path environment variable affects all new processes started by the current user.
Note
Microsoft encourages the usage of App Paths, because the more entries the path environment variable Path has, the more time Windows is spending for searching for specified files. With App Paths you can specify per executable name the folders where the executable should search.
More information: Microsoft Docs about App Paths.

Problems with javac

[EDIT][EDIT2][EDIT3]I need help as I am starting on JSP. My goal is to run the java compiler in the windows cmd and I have encounter this error:
'javac' is not recognised as an internal or external command,operable program or batch file.
What I have done to debug this problem so far:(Not in order)
Check the path name
redownload the sdk
rerun the cmd after changing to the correct path name
Edited the environment variable to include the sdk
And yet all fails what have I not done correctly.
My pathname is It still doesn't work. I am following instructions from here http://www3.ntu.edu.sg/home/ehchua/programming/howto/tomcat_howto.html
This is my pathname: C:\Program Files (x86)\Java\jdk1.8.0_60\bin
For ricovox: This is the complete cmd output for path
C:\Users\Zi>path
PATH=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracl
e\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel
\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS
\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bi
n\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel
\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Manag
ement Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Eng
ine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Compo
nents\IPT;C:\Program Files (x86)\Citrix\system32\;C:\Program Files (x86)\Windows
Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110
\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Prog
ram Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQ
L Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL S
erver\110\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Skyp
e\Phone\
Edit System Variable
Variable name: JAVA_HOME
Variable value: C:\Program Files (x86)\Java\jdk1.8.0_60\bin
So first, please verify that you have set the JAVA_HOME environment variable. Here are the instructions to set it:
Open the Windows Control Panel Go to System ⇒ Advanced system
settings
Switch to "Advanced" tab ⇒ Environment Variables
In the System Variables box, (not User variables), click "New" (or
"Edit" for modification)
In "Variable Name", enter "JAVA_HOME"
In "Variable Value", enter your JDK installed directory: C:\Program Files (x86)\Java\jdk1.8.0_60\bin.
Click OK and close that window.
Now, open up a NEW windows command prompt (cmd.exe) and type the following:
set JAVA_HOME
You should see something like this:
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_60\bin
Setting JAVA_HOME may be required for Tomcat/JSP, but just doing that will not necessarily allow you to run javac from the command-line. If you want to be able to do that, you also have to add the java bin folder to your PATH environment variable.
To do that, follow the same instructions as above, with some minor changes as shown below:
Open the Windows Control Panel Go to System ⇒ Advanced system
settings
Switch to "Advanced" tab ⇒ Environment Variables
In the System Variables box, (not User variables), find the Path variable in the list and click on it. Then click the "Edit" button.
Copy the entire value in the "Variable Value" field and save it somewhere (just in case you make a mistake and need to restore it later.)
Press the END key to go to the end of the current Path value, then enter a semicolon (;) followed by your java directory. For example:
C:\Windows;C:\Windows\system32;...SomeOtherFolders...;C:\Program Files (x86)\Java\jdk1.8.0_60\bin
Click OK and close that window.
Now, open up a NEW windows command prompt (cmd.exe) and type the following:
PATH
You should see a list of paths and the list should contain your java directory (it may or may not be the last path in the list, depending on whether you have a Path variable defined in the User variables section.)
Once you have the java bin folder in your PATH, you should be able to run javac from the command-line.
You can test this by opening a command prompt and typing javac -version You should see the output javac 1.8.0_60
You should also try %JAVA_HOME%\javac -version just to make sure your JAVA_HOME variable is correct.
I hope that helps.

Can we create the customize report after publish?

I am creating database project in visual studio 2013.After publish visual studio is creating report. Can we create the customize report after publish database on Dev/QA server.
try:
sqlpackage.exe /Action:DeployReport /SourceFile:PATHTODACPAC.dacpac /TargetServerName:ServerName /TargetDatabaseName:DatabaseName /OutputPath:c:\PathToReport.xml
Replace:
PATHTODACPAC.dac with the path to the dacpac
ServerName with the server name
DatabaseName with the database name
C:\PathToReport.xml with the path of the file you want the output in
sqlpackage.exe will be in one of these locations:
C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin
C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin
this will generate a deployment report. For all the possible parameters for sqlpackage.exe see:
https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx
ed

Resources