Blank path in environment variable causing elevated command prompt to not respond - cmd

While attempting to install composer on my Windows2008r2 server, I navigated to System Properties, Environnment Variables, and Edit Path, but when I changed the path the elevated cmd prompt stopped working. So I deleted the path and left it blank. Now the cmd prompt doesnt work, and the environment variable is still blank.
Does anyone know the default path for the system variable?

c:\windows\system32;c:\windows;c:\windows\system32\wbem
Is all that is required.

Related

Restore the previous system path variable (windows)

a question regarding messing with Windows Path variable.
My situation is quite specific:
I was trying to install ffmpeg according to this tutorial https://www.geeksforgeeks.org/how-to-install-ffmpeg-on-windows/
The last step was setting the path variable setx /m PATH "C:\ffmpeg\bin;%PATH%"
It worked, however afterwards I noticed that if I try to call python from the command prompt or the powershell if run as administrator, I started getting 'chcp' is not recognized as an internal or external command, (although works fine if run as user), indicating that something is wrong with PATH variables.
I looked into my variables and saw this edit.
Path
It seems to me that the command added the ffmpeg line to the system path and possibly overwritten the original, which is why there are issues when using command prompt as administrator. It probably should have added it to the user Path (not system Path variable)
If that is the case, is there a way to restore the previous system Path variable. Maybe I can paste it from the user Path variable?

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.

Windows PATH variable is different if whether running CMD as admin or not

I just installed scala but I can't call it from the command line. So I dutifully checked my path through the environmental variables of the control panel and saw the scala folder present. If I type scala from cmd within that folder, it works fine.
So I tried echo %PATH% from windows cmd to see any problem. If running a normal command window, I get almost the same path except it's missing the scala path item. If I run the command line (Admin), then the echoed path matches the environment variables version. Under this admin setting, scala works fine.
There is no user path variable defined, it's only a system variable.
I've never seen this before. Why is there a difference between admin path and non-admin path? And how do I access the scala path item from the non-admin command line?
Thanks!
I just had the same problem, it was caused by the environment variables not being refreshed. A reboot would have solved it, however there is a way to refresh the environment variables without a reboot.
Open cmd prompt window
Input set PATH=C
close and restart cmd prompt window
input echo %PATH% to check
This worked for me in Windows 10.

How to get Windows OS Environment Variable from System Property

I am encountering a strange problem about System Property environment variable.
As you know, we can open Computer->Property->Advanced System Settings->Advanced->System Environment Variables->User Variables for admin
I change Variable TEMP' value to C:\mytemp\ and click OK to save it.
However, In command line, when I echo %TEMP%, it still show original path, C:\Users\admin\AppData\Local\Temp.
When I input %TEMP% in explorer, it will go to C:\mytemp
Now I want to user API to get the path, GetEnvironmentVariable() will also return path which is same as echo %TEMP% in command line. how can I get the path as exploer did.
Thanks in advance.
PS. OS is Win7 x86
Changing environment path through Computer->Property->Advanced System Settings->Advanced->System Environment Variables->User Variables will take effect immediately. However, please be noted that those programs which are running will not get the latest environment variable.
So I thought that you simply didn't reopen a new cmd for echo.
Open a new cmd, and echo again, the new path will be shown.
The environment variables are set when the process runs and are not updated.
To verify this, open a command prompt, and type "echo %TEMP%". Keep the command prompt open and change the %TEMP% variable. No matter what, entering "echo %TEMP%" will print the old values.
Now open a new command prompt and "echo %TEMP%", the new command prompt will print the new values.
As a workaround, you can spin up a new thread to check the current setting at that particular time.

javac is not working even after setting the path in windows xp

Friends I couldn't access java in my xp even after i set the path
i set the path as set path="C:\Program Files\Java\jdk1.7.0_25\bin"
It doesn't work in xp But it is useful in my windows 7 System
Don't know why
Please answer me
I also set path variable in the environment variables tab.But that doesn't worked for me
Still my javac command says javac is not recognised external or internal command.
So please help me
Run this command in Command Prompt/CMD
set path="%path%;c:\program files\java\jdk1.7.0_25\bin"
If you already have a instance of terminal opened, you'll have to close it and re-open for work. Make sure this path C:\Program Files\Java\jdk1.7.0_25\bin is valid and has javac.
1>First check if java is really installed in your PC.
You can do this by going to
C drive->Program Files->Java
Inside java you should have two folders
1. jdk
2.jre
2> copy the path C:\Program Files\Java\jdk1.7.0_25\bin
(jdk1.7.0_25 is the jdk version you have installed as you mentioned)
3>Go to advanced system settings and click on Environment variables
4>Click on new and you will have two fill the variable name and variable value.
type in " PATH " (without the double quotes and in CAPS) in the variable name
and paste the copied path in the variable name field.
5>Now open a new command prompt and type javac.
You should see a list and not the error you mentioned.
Another way..but this way is only a temporary solution since once you close cmd you will have to set path again.
You can even set path= (paste the path you copied after the equals sign)
First follow these steps
Start -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH.
If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
now Run where java. this should return java path up to java.exe
If still you are having issues leave a comment

Resources